diff --git a/doric-js/bundle/doric-sandbox.es5.js b/doric-js/bundle/doric-sandbox.es5.js index a10052ca..f402cdc4 100644 --- a/doric-js/bundle/doric-sandbox.es5.js +++ b/doric-js/bundle/doric-sandbox.es5.js @@ -17203,7 +17203,9 @@ var doric = (function (exports) { } hookBeforeNativeCall(context); Reflect.apply(callback.resolve, context, argumentsList); - context.callbacks.delete(callbackId); + if (callback.retained !== true) { + context.callbacks.delete(callbackId); + } } function jsCallReject(contextId, callbackId, args) { var arguments$1 = arguments; @@ -17224,7 +17226,9 @@ var doric = (function (exports) { } hookBeforeNativeCall(context); Reflect.apply(callback.reject, context.entity, argumentsList); - context.callbacks.delete(callbackId); + if (callback.retained !== true) { + context.callbacks.delete(callbackId); + } } var Context = /** @class */ (function () { function Context(id) { @@ -17260,7 +17264,8 @@ var doric = (function (exports) { var functionId = uniqueId('function'); this.callbacks.set(functionId, { resolve: func, - reject: function () { loge("This should not be called"); } + reject: function () { loge("This should not be called"); }, + retained: true, }); return functionId; }; diff --git a/doric-js/src/util/types.ts b/doric-js/src/util/types.ts index 03d01701..00d92f31 100644 --- a/doric-js/src/util/types.ts +++ b/doric-js/src/util/types.ts @@ -23,7 +23,7 @@ export function obj2Model(obj: Model, convertor: (v: Function) => string): Model return obj.map(e => obj2Model(e, convertor)) as Model } else if (obj instanceof Object) { if (Reflect.has(obj, 'toModel') && Reflect.get(obj, 'toModel') instanceof Function) { - obj = Reflect.apply(Reflect.get(obj, 'toModel'), obj, []) + obj = Reflect.apply(Reflect.get(obj, 'toModel') as Function, obj, []) return obj } else { for (let key in obj) {