Add Load Internal Class Support
This commit is contained in:
parent
6a09c583fc
commit
a5ca58c38a
@ -32,6 +32,17 @@ class MultiPanelDemo extends Panel {
|
||||
navigator(context).push(CounterPage)
|
||||
}
|
||||
}),
|
||||
label('Multi Panel').apply({
|
||||
width: 200,
|
||||
height: 50,
|
||||
backgroundColor: colors[0],
|
||||
textSize: 30,
|
||||
textColor: Color.WHITE,
|
||||
layoutConfig: layoutConfig().just(),
|
||||
onClick: () => {
|
||||
navigator(context).push(MultiPanelDemo)
|
||||
}
|
||||
}),
|
||||
],
|
||||
{
|
||||
layoutConfig: layoutConfig().most().configHeight(LayoutSpec.FIT),
|
||||
|
@ -1205,19 +1205,21 @@ var doric = (function (exports) {
|
||||
});
|
||||
})(Reflect$1 || (Reflect$1 = {}));
|
||||
|
||||
var __extends = (undefined && undefined.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
/*
|
||||
* Copyright [2019] [Doric.Pub]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
function hookBeforeNativeCall(context) {
|
||||
if (context) {
|
||||
Reflect.defineMetadata('__doric_context__', context, global$1);
|
||||
@ -1396,19 +1398,11 @@ var doric = (function (exports) {
|
||||
function jsObtainEntry(contextId) {
|
||||
var context = jsObtainContext(contextId);
|
||||
var exportFunc = function (constructor) {
|
||||
var _a;
|
||||
(_a = context === null || context === void 0 ? void 0 : context.classes) === null || _a === void 0 ? void 0 : _a.set(constructor.name, constructor);
|
||||
var ret = /** @class */ (function (_super) {
|
||||
__extends(class_1, _super);
|
||||
function class_1() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
_this.context = context;
|
||||
return _this;
|
||||
}
|
||||
return class_1;
|
||||
}(constructor));
|
||||
context === null || context === void 0 ? void 0 : context.register(new ret);
|
||||
return ret;
|
||||
context === null || context === void 0 ? void 0 : context.classes.set(constructor.name, constructor);
|
||||
var ret = new constructor;
|
||||
Reflect.set(ret, 'context', context);
|
||||
context === null || context === void 0 ? void 0 : context.register(ret);
|
||||
return constructor;
|
||||
};
|
||||
return function () {
|
||||
if (arguments.length === 1) {
|
||||
|
@ -1397,24 +1397,18 @@ var doric = (function (exports) {
|
||||
function jsObtainEntry(contextId) {
|
||||
const context = jsObtainContext(contextId);
|
||||
const exportFunc = (constructor) => {
|
||||
var _a;
|
||||
(_a = context === null || context === void 0 ? void 0 : context.classes) === null || _a === void 0 ? void 0 : _a.set(constructor.name, constructor);
|
||||
const ret = class extends constructor {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.context = context;
|
||||
}
|
||||
};
|
||||
context === null || context === void 0 ? void 0 : context.register(new ret);
|
||||
return ret;
|
||||
context === null || context === void 0 ? void 0 : context.classes.set(constructor.name, constructor);
|
||||
const ret = new constructor;
|
||||
Reflect.set(ret, 'context', context);
|
||||
context === null || context === void 0 ? void 0 : context.register(ret);
|
||||
return constructor;
|
||||
};
|
||||
return function () {
|
||||
if (arguments.length === 1) {
|
||||
const args = arguments[0];
|
||||
if (args instanceof Array) {
|
||||
args.forEach(clz => {
|
||||
var _a;
|
||||
(_a = context === null || context === void 0 ? void 0 : context.classes) === null || _a === void 0 ? void 0 : _a.set(clz.name, clz);
|
||||
context === null || context === void 0 ? void 0 : context.classes.set(clz.name, clz);
|
||||
});
|
||||
return exportFunc;
|
||||
}
|
||||
|
@ -1420,24 +1420,18 @@ function jsCallEntityMethod(contextId, methodName, args) {
|
||||
function jsObtainEntry(contextId) {
|
||||
const context = jsObtainContext(contextId);
|
||||
const exportFunc = (constructor) => {
|
||||
var _a;
|
||||
(_a = context === null || context === void 0 ? void 0 : context.classes) === null || _a === void 0 ? void 0 : _a.set(constructor.name, constructor);
|
||||
const ret = class extends constructor {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.context = context;
|
||||
}
|
||||
};
|
||||
context === null || context === void 0 ? void 0 : context.register(new ret);
|
||||
return ret;
|
||||
context === null || context === void 0 ? void 0 : context.classes.set(constructor.name, constructor);
|
||||
const ret = new constructor;
|
||||
Reflect.set(ret, 'context', context);
|
||||
context === null || context === void 0 ? void 0 : context.register(ret);
|
||||
return constructor;
|
||||
};
|
||||
return function () {
|
||||
if (arguments.length === 1) {
|
||||
const args = arguments[0];
|
||||
if (args instanceof Array) {
|
||||
args.forEach(clz => {
|
||||
var _a;
|
||||
(_a = context === null || context === void 0 ? void 0 : context.classes) === null || _a === void 0 ? void 0 : _a.set(clz.name, clz);
|
||||
context === null || context === void 0 ? void 0 : context.classes.set(clz.name, clz);
|
||||
});
|
||||
return exportFunc;
|
||||
}
|
||||
|
10
doric-js/lib/src/runtime/sandbox.d.ts
vendored
10
doric-js/lib/src/runtime/sandbox.d.ts
vendored
@ -23,14 +23,6 @@ export declare function __require__(name: string): any;
|
||||
export declare function jsRegisterModule(name: string, moduleObject: any): void;
|
||||
export declare function jsCallEntityMethod(contextId: string, methodName: string, args?: any): any;
|
||||
declare type ClassType<T> = new (...args: any) => T;
|
||||
export declare function jsObtainEntry(contextId: string): () => ((constructor: ClassType<object>) => {
|
||||
new (...args: any): {
|
||||
context: Context | undefined;
|
||||
};
|
||||
}) | {
|
||||
new (...args: any): {
|
||||
context: Context | undefined;
|
||||
};
|
||||
};
|
||||
export declare function jsObtainEntry(contextId: string): () => ClassType<object> | ((constructor: ClassType<object>) => ClassType<object>);
|
||||
export declare function jsCallbackTimer(timerId: number): void;
|
||||
export {};
|
||||
|
@ -215,24 +215,18 @@ export function jsCallEntityMethod(contextId, methodName, args) {
|
||||
export function jsObtainEntry(contextId) {
|
||||
const context = jsObtainContext(contextId);
|
||||
const exportFunc = (constructor) => {
|
||||
var _a;
|
||||
(_a = context === null || context === void 0 ? void 0 : context.classes) === null || _a === void 0 ? void 0 : _a.set(constructor.name, constructor);
|
||||
const ret = class extends constructor {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.context = context;
|
||||
}
|
||||
};
|
||||
context === null || context === void 0 ? void 0 : context.register(new ret);
|
||||
return ret;
|
||||
context === null || context === void 0 ? void 0 : context.classes.set(constructor.name, constructor);
|
||||
const ret = new constructor;
|
||||
Reflect.set(ret, 'context', context);
|
||||
context === null || context === void 0 ? void 0 : context.register(ret);
|
||||
return constructor;
|
||||
};
|
||||
return function () {
|
||||
if (arguments.length === 1) {
|
||||
const args = arguments[0];
|
||||
if (args instanceof Array) {
|
||||
args.forEach(clz => {
|
||||
var _a;
|
||||
(_a = context === null || context === void 0 ? void 0 : context.classes) === null || _a === void 0 ? void 0 : _a.set(clz.name, clz);
|
||||
context === null || context === void 0 ? void 0 : context.classes.set(clz.name, clz);
|
||||
});
|
||||
return exportFunc;
|
||||
}
|
||||
|
@ -240,12 +240,11 @@ type ClassType<T> = new (...args: any) => T
|
||||
export function jsObtainEntry(contextId: string) {
|
||||
const context = jsObtainContext(contextId)
|
||||
const exportFunc = (constructor: ClassType<object>) => {
|
||||
context?.classes?.set(constructor.name, constructor)
|
||||
const ret = class extends constructor {
|
||||
context = context
|
||||
}
|
||||
context?.register(new ret)
|
||||
return ret
|
||||
context?.classes.set(constructor.name, constructor)
|
||||
const ret = new constructor
|
||||
Reflect.set(ret, 'context', context)
|
||||
context?.register(ret)
|
||||
return constructor
|
||||
}
|
||||
return function () {
|
||||
if (arguments.length === 1) {
|
||||
|
@ -278,19 +278,18 @@ type ClassType<T> = new (...args: any) => T
|
||||
export function jsObtainEntry(contextId: string) {
|
||||
const context = jsObtainContext(contextId)
|
||||
const exportFunc = (constructor: ClassType<object>) => {
|
||||
context?.classes?.set(constructor.name, constructor)
|
||||
const ret = class extends constructor {
|
||||
context = context
|
||||
}
|
||||
context?.register(new ret)
|
||||
return ret
|
||||
context?.classes.set(constructor.name, constructor)
|
||||
const ret = new constructor
|
||||
Reflect.set(ret, 'context', context)
|
||||
context?.register(ret)
|
||||
return constructor
|
||||
}
|
||||
return function () {
|
||||
if (arguments.length === 1) {
|
||||
const args = arguments[0]
|
||||
if (args instanceof Array) {
|
||||
args.forEach(clz => {
|
||||
context?.classes?.set(clz.name, clz)
|
||||
context?.classes.set(clz.name, clz)
|
||||
})
|
||||
return exportFunc
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user