Node.js 764 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import { NodeUpdateType } from './constants.js';
  2. class Node {
  3. constructor( nodeType = null ) {
  4. this.nodeType = nodeType;
  5. this.updateType = NodeUpdateType.None;
  6. }
  7. get type() {
  8. return this.constructor.name;
  9. }
  10. getUpdateType( /*builder*/ ) {
  11. return this.updateType;
  12. }
  13. getNodeType( /*builder*/ ) {
  14. return this.nodeType;
  15. }
  16. getTypeLength( builder ) {
  17. return builder.getTypeLength( this.getNodeType( builder ) );
  18. }
  19. update( /*frame*/ ) {
  20. console.warn( 'Abstract function.' );
  21. }
  22. generate( /*builder, output*/ ) {
  23. console.warn( 'Abstract function.' );
  24. }
  25. build( builder, output = null ) {
  26. builder.addNode( this );
  27. return this.generate( builder, output );
  28. }
  29. }
  30. Node.prototype.isNode = true;
  31. export default Node;