Tengo tres bibliotecas separadas:
Creó una instancia de Export.js en HamburgerMenu.js y luego pasó un método de instancia a través de Loading.js para ejecutar el método. Pero hay un error en Loding.js que no puede acceder al editor en Export.js .
Export.js y Loading.js no tienen una relación directa.
¿Cómo puedo resolverlo?
class Export { constructor(editor) { this.editor = editor; } exportGeometry() { var object = this.editor.selected; // return error : editor is undefined ... } } import { Export } from './Export'; import { Loading } from './loading'; function HamburgerMenu(editor) { var exportModule = new Export(editor); var loading = new Loading('Please Wait..', 'Preparing to download ...', exportModule.exportGeometry); } class Loading { constructor(title, message, Fun) { this.title = title; this.message = message; Fun(); // Fun here is exportGeometry that passed from HamburgerMenu }