Node.js 618 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import { NodeUpdateType } from './constants.js';
  2. class Node {
  3. constructor( type = null ) {
  4. this.type = type;
  5. this.updateType = NodeUpdateType.None;
  6. Object.defineProperty( this, 'isNode', { value: true } );
  7. }
  8. getUpdateType( /*builder*/ ) {
  9. return this.updateType;
  10. }
  11. getType( /*builder*/ ) {
  12. return this.type;
  13. }
  14. update( /*frame*/ ) {
  15. console.warn( 'Abstract function.' );
  16. }
  17. generate( /*builder, output*/ ) {
  18. console.warn( 'Abstract function.' );
  19. }
  20. build( builder, output ) {
  21. builder.addNode( this );
  22. return this.generate( builder, output );
  23. }
  24. }
  25. export default Node;