2
0

ObjectNode.js 564 B

12345678910111213141516171819202122232425262728293031323334
  1. import { Node, TitleElement, ButtonInput } from '../../libs/flow.module.js';
  2. export class ObjectNode extends Node {
  3. constructor( name, inputLength, extra = null ) {
  4. super();
  5. const title = new TitleElement( name )
  6. .setExtra( extra )
  7. .setOutput( inputLength );
  8. const closeButton = new ButtonInput( '✖' ).onClick( () => {
  9. this.dispose();
  10. } );
  11. title.addButton( closeButton );
  12. this.add( title );
  13. this.title = title;
  14. this.closeButton = closeButton;
  15. }
  16. invalidate() {
  17. this.title.dispatchEvent( new Event( 'connect' ) );
  18. }
  19. }