}
code = `const app = require('${filename}')`;
if (service_type === 'DAEMON') {
- internal_handler[id].deivce_api_router = new DeviceAPIRouter();
+ internal_handler[id].deivce_api_router = new DeviceAPIRouter(sandbox[id]);
}
vm.runInNewContext(code, sandbox[id], options);
}
export class DeviceAPIRouter {
currentApplication: any;
+ sandbox: any;
funcCurrentApplication: any;
funcRequestedAppcontrol: any;
funcGetAppInfo: any;
funcGetPackageInfo: any;
funcPathResolve: any;
- constructor() {
+ constructor(sandbox: any) {
+ this.sandbox = sandbox;
this.RefineApplicationApis();
this.RefinePackageApis();
this.RefineFilesystemApis()
}
GetServiceId() {
- return global.webapis.getServiceId();
+ return this.sandbox.webapis.getServiceId();
}
GetPackageId() {
- return global.webapis.getPackageId();
+ return this.sandbox.webapis.getPackageId();
}
RefineApplicationApis() {
this.funcPathResolve(location, onSuccess, onError, mode ?? 'rw');
}
}
-}
\ No newline at end of file
+}