@@ -227,11 +227,11 @@ export class Editor {
227227 return this . blocklyWorkspace ;
228228 }
229229
230- public getCurrentModuleType ( ) : string {
230+ public getCurrentModuleType ( ) : storageModule . ModuleType | null {
231231 if ( this . currentModule ) {
232232 return this . currentModule . moduleType ;
233233 }
234- return storageModule . MODULE_TYPE_UNKNOWN ;
234+ return null ;
235235 }
236236
237237 private getModuleContentText ( ) : string {
@@ -248,8 +248,8 @@ export class Editor {
248248 const components : storageModuleContent . Component [ ] = this . getComponentsFromWorkspace ( ) ;
249249 const events : storageModuleContent . Event [ ] = this . getEventsFromWorkspace ( ) ;
250250 const methods : storageModuleContent . Method [ ] = (
251- this . currentModule ?. moduleType === storageModule . MODULE_TYPE_ROBOT ||
252- this . currentModule ?. moduleType === storageModule . MODULE_TYPE_MECHANISM )
251+ this . currentModule ?. moduleType === storageModule . ModuleType . ROBOT ||
252+ this . currentModule ?. moduleType === storageModule . ModuleType . MECHANISM )
253253 ? this . getMethodsForOutsideFromWorkspace ( )
254254 : [ ] ;
255255 return storageModuleContent . makeModuleContentText (
@@ -258,16 +258,16 @@ export class Editor {
258258
259259 public getMechanismsFromWorkspace ( ) : storageModuleContent . MechanismInRobot [ ] {
260260 const mechanisms : storageModuleContent . MechanismInRobot [ ] = [ ] ;
261- if ( this . currentModule ?. moduleType === storageModule . MODULE_TYPE_ROBOT ) {
261+ if ( this . currentModule ?. moduleType === storageModule . ModuleType . ROBOT ) {
262262 mechanismComponentHolder . getMechanisms ( this . blocklyWorkspace , mechanisms ) ;
263263 }
264264 return mechanisms ;
265265 }
266266
267267 public getComponentsFromWorkspace ( ) : storageModuleContent . Component [ ] {
268268 const components : storageModuleContent . Component [ ] = [ ] ;
269- if ( this . currentModule ?. moduleType === storageModule . MODULE_TYPE_ROBOT ||
270- this . currentModule ?. moduleType === storageModule . MODULE_TYPE_MECHANISM ) {
269+ if ( this . currentModule ?. moduleType === storageModule . ModuleType . ROBOT ||
270+ this . currentModule ?. moduleType === storageModule . ModuleType . MECHANISM ) {
271271 mechanismComponentHolder . getComponents ( this . blocklyWorkspace , components ) ;
272272 }
273273 return components ;
@@ -294,8 +294,8 @@ export class Editor {
294294
295295 public getEventsFromWorkspace ( ) : storageModuleContent . Event [ ] {
296296 const events : storageModuleContent . Event [ ] = [ ] ;
297- if ( this . currentModule ?. moduleType === storageModule . MODULE_TYPE_ROBOT ||
298- this . currentModule ?. moduleType === storageModule . MODULE_TYPE_MECHANISM ) {
297+ if ( this . currentModule ?. moduleType === storageModule . ModuleType . ROBOT ||
298+ this . currentModule ?. moduleType === storageModule . ModuleType . MECHANISM ) {
299299 mechanismComponentHolder . getEvents ( this . blocklyWorkspace , events ) ;
300300 }
301301 return events ;
@@ -329,7 +329,7 @@ export class Editor {
329329 * Returns the mechanisms defined in the robot.
330330 */
331331 public getMechanismsFromRobot ( ) : storageModuleContent . MechanismInRobot [ ] {
332- if ( this . currentModule ?. moduleType === storageModule . MODULE_TYPE_ROBOT ) {
332+ if ( this . currentModule ?. moduleType === storageModule . ModuleType . ROBOT ) {
333333 return this . getMechanismsFromWorkspace ( ) ;
334334 }
335335 if ( this . robotContent ) {
@@ -342,7 +342,7 @@ export class Editor {
342342 * Returns the components defined in the robot.
343343 */
344344 public getComponentsFromRobot ( ) : storageModuleContent . Component [ ] {
345- if ( this . currentModule ?. moduleType === storageModule . MODULE_TYPE_ROBOT ) {
345+ if ( this . currentModule ?. moduleType === storageModule . ModuleType . ROBOT ) {
346346 return this . getComponentsFromWorkspace ( ) ;
347347 }
348348 if ( this . robotContent ) {
@@ -355,7 +355,7 @@ export class Editor {
355355 * Returns the events defined in the robot.
356356 */
357357 public getEventsFromRobot ( ) : storageModuleContent . Event [ ] {
358- if ( this . currentModule ?. moduleType === storageModule . MODULE_TYPE_ROBOT ) {
358+ if ( this . currentModule ?. moduleType === storageModule . ModuleType . ROBOT ) {
359359 return this . getEventsFromWorkspace ( ) ;
360360 }
361361 if ( this . robotContent ) {
@@ -368,7 +368,7 @@ export class Editor {
368368 * Returns the methods defined in the robot.
369369 */
370370 public getMethodsFromRobot ( ) : storageModuleContent . Method [ ] {
371- if ( this . currentModule ?. moduleType === storageModule . MODULE_TYPE_ROBOT ) {
371+ if ( this . currentModule ?. moduleType === storageModule . ModuleType . ROBOT ) {
372372 return this . getMethodsForWithinFromWorkspace ( ) ;
373373 }
374374 if ( this . robotContent ) {
0 commit comments