InstanceInsertOperation.js 431 B

1234567891011121314151617181920
  1. const InsertOperation = require('./InsertOperation');
  2. class InstanceInsertOperation extends InsertOperation {
  3. constructor(name, opt) {
  4. super(name, opt);
  5. this.instance = opt.instance;
  6. }
  7. onAdd(builder, args) {
  8. if (!args || args.length === 0) {
  9. args = [this.instance];
  10. } else {
  11. args[0] = this.instance;
  12. }
  13. return super.onAdd(builder, args);
  14. }
  15. }
  16. module.exports = InstanceInsertOperation;