@@ -38,6 +38,9 @@ const EMPTY_TOOLBOX: Blockly.utils.toolbox.ToolboxDefinition = {
3838 contents : [ ] ,
3939} ;
4040
41+ const MRC_ON_LOAD = 'mrcOnLoad' ;
42+ const MRC_VALIDATE = 'mrcValidate' ;
43+
4144export class Editor {
4245 private static workspaceIdToEditor : { [ workspaceId : string ] : Editor } = { } ;
4346 private static currentEditor : Editor | null = null ;
@@ -97,8 +100,8 @@ export class Editor {
97100 blockCreateEvent . ids . forEach ( id => {
98101 const block = this . blocklyWorkspace . getBlockById ( id ) ;
99102 if ( block ) {
100- if ( 'mrcOnLoad' in block && typeof block . mrcOnLoad === " function" ) {
101- block . mrcOnLoad ( ) ;
103+ if ( MRC_ON_LOAD in block && typeof block [ MRC_ON_LOAD ] === ' function' ) {
104+ block [ MRC_ON_LOAD ] ( ) ;
102105 }
103106 }
104107 } ) ;
@@ -132,8 +135,8 @@ export class Editor {
132135
133136 // Go through all the blocks in the workspace and call their mrcValidate method.
134137 this . blocklyWorkspace . getAllBlocks ( ) . forEach ( block => {
135- if ( 'mrcValidate' in block && typeof block . mrcValidate === " function" ) {
136- block . mrcValidate ( ) ;
138+ if ( MRC_VALIDATE in block && typeof block [ MRC_VALIDATE ] === ' function' ) {
139+ block [ MRC_VALIDATE ] ( ) ;
137140 }
138141 } ) ;
139142 }
@@ -165,8 +168,8 @@ export class Editor {
165168 for ( const mechanism of this . mechanisms ) {
166169 const moduleContent = this . modulePathToModuleContent [ mechanism . modulePath ] ;
167170 if ( ! moduleContent ) {
168- console . error ( this . modulePath + " editor.parseModules - modulePathToModuleContent['" +
169- mechanism . modulePath + "' ] is undefined" ) ;
171+ console . error ( this . modulePath + ' editor.parseModules - modulePathToModuleContent["' +
172+ mechanism . modulePath + '" ] is undefined' ) ;
170173 continue ;
171174 }
172175 this . mechanismClassNameToModuleContent [ mechanism . className ] = moduleContent ;
0 commit comments