update iOS header import

This commit is contained in:
pengfei.zhou 2020-10-23 16:48:44 +08:00 committed by osborn
parent a913a5d700
commit c702f546ee
4 changed files with 50 additions and 12 deletions

View File

@ -20,7 +20,7 @@
// Created by on 2019/10/31. // Created by on 2019/10/31.
// //
#import "DoricJSRemoteExecutor.h" #import "DoricJSRemoteExecutor.h"
#import <SocketRocket/SRWebSocket.h> #import "SRWebSocket.h"
#import "DoricUtil.h" #import "DoricUtil.h"
#import "DoricJSRemoteArgType.h" #import "DoricJSRemoteArgType.h"
#import "NSString+JsonString.h" #import "NSString+JsonString.h"

View File

@ -21,7 +21,7 @@
// //
#import "DoricWSClient.h" #import "DoricWSClient.h"
#import <SocketRocket/SRWebSocket.h> #import "SRWebSocket.h"
#import "DoricUtil.h" #import "DoricUtil.h"
#import "DoricContextManager.h" #import "DoricContextManager.h"

View File

@ -1258,6 +1258,7 @@ var doric = (function (exports) {
class Context { class Context {
constructor(id) { constructor(id) {
this.callbacks = new Map; this.callbacks = new Map;
this.classes = new Map;
this.id = id; this.id = id;
return new Proxy(this, { return new Proxy(this, {
get: (target, p) => { get: (target, p) => {
@ -1397,17 +1398,46 @@ var doric = (function (exports) {
} }
function jsObtainEntry(contextId) { function jsObtainEntry(contextId) {
const context = jsObtainContext(contextId); const context = jsObtainContext(contextId);
return (constructor) => { const exportFunc = (constructor) => {
const ret = class extends constructor { context === null || context === void 0 ? void 0 : context.classes.set(constructor.name, constructor);
constructor() { const ret = new constructor;
super(...arguments); Reflect.set(ret, 'context', context);
this.context = context; context === null || context === void 0 ? void 0 : context.register(ret);
} return constructor;
}; };
if (context) { return function () {
context.register(new ret); if (arguments.length === 1) {
const args = arguments[0];
if (args instanceof Array) {
args.forEach(clz => {
context === null || context === void 0 ? void 0 : context.classes.set(clz.name, clz);
});
return exportFunc;
}
else {
return exportFunc(args);
}
}
else if (arguments.length === 2) {
const srcContextId = arguments[0];
const className = arguments[1];
const srcContext = gContexts.get(srcContextId);
if (srcContext) {
const clz = srcContext.classes.get(className);
if (clz) {
return exportFunc(clz);
}
else {
throw new Error(`Cannot find class:${className} in context:${srcContextId}`);
}
}
else {
throw new Error(`Cannot find context for ${srcContextId}`);
}
}
else {
throw new Error(`Entry arguments error:${arguments}`);
} }
return ret;
}; };
} }
const global$1 = Function('return this')(); const global$1 = Function('return this')();
@ -3808,10 +3838,16 @@ function navbar(context) {
}; };
} }
function internalScheme(context, panelClass) {
return `_internal_://export?class=${encodeURIComponent(panelClass.name)}&context=${context.id}`;
}
function navigator(context) { function navigator(context) {
const moduleName = "navigator"; const moduleName = "navigator";
return { return {
push: (source, config) => { push: (source, config) => {
if (typeof source === 'function') {
source = internalScheme(context, source);
}
if (config && config.extra) { if (config && config.extra) {
config.extra = JSON.stringify(config.extra); config.extra = JSON.stringify(config.extra);
} }
@ -4206,6 +4242,7 @@ class VMPanel extends Panel {
build(root) { build(root) {
this.vh = new (this.getViewHolderClass()); this.vh = new (this.getViewHolderClass());
this.vm = new (this.getViewModelClass())(this.getState(), this.vh); this.vm = new (this.getViewModelClass())(this.getState(), this.vh);
this.vm.context = this.context;
this.vm.attach(root); this.vm.attach(root);
} }
} }
@ -4268,6 +4305,7 @@ exports.gravity = gravity;
exports.hlayout = hlayout; exports.hlayout = hlayout;
exports.image = image; exports.image = image;
exports.input = input; exports.input = input;
exports.internalScheme = internalScheme;
exports.layoutConfig = layoutConfig; exports.layoutConfig = layoutConfig;
exports.list = list; exports.list = list;
exports.listItem = listItem; exports.listItem = listItem;

File diff suppressed because one or more lines are too long