android&iOS:create context set this to undefined
This commit is contained in:
parent
cdaebe46cd
commit
0087c5bda4
@ -222,7 +222,7 @@ public class DoricJSEngine implements Handler.Callback, DoricTimerExtension.Time
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String packageContextScript(String contextId, String content) {
|
private String packageContextScript(String contextId, String content) {
|
||||||
return String.format(DoricConstant.TEMPLATE_CONTEXT_CREATE, content, contextId, contextId, contextId);
|
return String.format(DoricConstant.TEMPLATE_CONTEXT_CREATE, content, contextId, contextId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String packageModuleScript(String moduleName, String content) {
|
private String packageModuleScript(String moduleName, String content) {
|
||||||
|
@ -38,7 +38,7 @@ public class DoricConstant {
|
|||||||
public static final String TEMPLATE_CONTEXT_CREATE = "Reflect.apply(" +
|
public static final String TEMPLATE_CONTEXT_CREATE = "Reflect.apply(" +
|
||||||
"function(doric,context,Entry,require,exports){" + "\n" +
|
"function(doric,context,Entry,require,exports){" + "\n" +
|
||||||
"%s" + "\n" +
|
"%s" + "\n" +
|
||||||
"},doric.jsObtainContext(\"%s\"),[" +
|
"},undefined,[" +
|
||||||
"undefined," +
|
"undefined," +
|
||||||
"doric.jsObtainContext(\"%s\")," +
|
"doric.jsObtainContext(\"%s\")," +
|
||||||
"doric.jsObtainEntry(\"%s\")," +
|
"doric.jsObtainEntry(\"%s\")," +
|
||||||
|
@ -150,7 +150,7 @@ - (JSValue *)invokeDoricMethod:(NSString *)method argumentsArray:(NSArray *)args
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (NSString *)packageContextScript:(NSString *)contextId content:(NSString *)content {
|
- (NSString *)packageContextScript:(NSString *)contextId content:(NSString *)content {
|
||||||
NSString *ret = [NSString stringWithFormat:TEMPLATE_CONTEXT_CREATE, content, contextId, contextId, contextId];
|
NSString *ret = [NSString stringWithFormat:TEMPLATE_CONTEXT_CREATE, content, contextId, contextId];
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
NSString *const TEMPLATE_CONTEXT_CREATE = @"Reflect.apply("
|
NSString *const TEMPLATE_CONTEXT_CREATE = @"Reflect.apply("
|
||||||
"function(doric,context,Entry,require,exports){" "\n"
|
"function(doric,context,Entry,require,exports){" "\n"
|
||||||
"%@" "\n"
|
"%@" "\n"
|
||||||
"},doric.jsObtainContext(\"%@\"),["
|
"},undefined,["
|
||||||
"undefined,"
|
"undefined,"
|
||||||
"doric.jsObtainContext(\"%@\"),"
|
"doric.jsObtainContext(\"%@\"),"
|
||||||
"doric.jsObtainEntry(\"%@\"),"
|
"doric.jsObtainEntry(\"%@\"),"
|
||||||
|
@ -2081,6 +2081,25 @@ function animate(context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function notification(context) {
|
||||||
|
return {
|
||||||
|
publish: (args) => {
|
||||||
|
if (args.data !== undefined) {
|
||||||
|
args.data = JSON.stringify(args.data);
|
||||||
|
}
|
||||||
|
return context.notification.publish(args);
|
||||||
|
},
|
||||||
|
subscribe: (args) => {
|
||||||
|
args.callback = context.function2Id(args.callback);
|
||||||
|
return context.notification.subscribe(args);
|
||||||
|
},
|
||||||
|
unsubscribe: (subscribeId) => {
|
||||||
|
context.removeFuncById(subscribeId);
|
||||||
|
return context.notification.unsubscribe({ subscribeId });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
class Observable {
|
class Observable {
|
||||||
constructor(provider, clz) {
|
constructor(provider, clz) {
|
||||||
this.observers = new Set;
|
this.observers = new Set;
|
||||||
@ -2224,6 +2243,7 @@ exports.modal = modal;
|
|||||||
exports.navbar = navbar;
|
exports.navbar = navbar;
|
||||||
exports.navigator = navigator;
|
exports.navigator = navigator;
|
||||||
exports.network = network;
|
exports.network = network;
|
||||||
|
exports.notification = notification;
|
||||||
exports.obj2Model = obj2Model;
|
exports.obj2Model = obj2Model;
|
||||||
exports.popover = popover;
|
exports.popover = popover;
|
||||||
exports.pullable = pullable;
|
exports.pullable = pullable;
|
||||||
|
@ -3540,6 +3540,25 @@ function animate(context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function notification(context) {
|
||||||
|
return {
|
||||||
|
publish: (args) => {
|
||||||
|
if (args.data !== undefined) {
|
||||||
|
args.data = JSON.stringify(args.data);
|
||||||
|
}
|
||||||
|
return context.notification.publish(args);
|
||||||
|
},
|
||||||
|
subscribe: (args) => {
|
||||||
|
args.callback = context.function2Id(args.callback);
|
||||||
|
return context.notification.subscribe(args);
|
||||||
|
},
|
||||||
|
unsubscribe: (subscribeId) => {
|
||||||
|
context.removeFuncById(subscribeId);
|
||||||
|
return context.notification.unsubscribe({ subscribeId });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
class Observable {
|
class Observable {
|
||||||
constructor(provider, clz) {
|
constructor(provider, clz) {
|
||||||
this.observers = new Set;
|
this.observers = new Set;
|
||||||
@ -3789,6 +3808,7 @@ exports.modal = modal;
|
|||||||
exports.navbar = navbar;
|
exports.navbar = navbar;
|
||||||
exports.navigator = navigator;
|
exports.navigator = navigator;
|
||||||
exports.network = network;
|
exports.network = network;
|
||||||
|
exports.notification = notification;
|
||||||
exports.obj2Model = obj2Model;
|
exports.obj2Model = obj2Model;
|
||||||
exports.popover = popover;
|
exports.popover = popover;
|
||||||
exports.pullable = pullable;
|
exports.pullable = pullable;
|
||||||
|
20
doric-js/index.d.ts
vendored
20
doric-js/index.d.ts
vendored
@ -64,6 +64,7 @@ declare module 'doric/lib/src/native/index.native' {
|
|||||||
export * from 'doric/lib/src/native/storage';
|
export * from 'doric/lib/src/native/storage';
|
||||||
export * from 'doric/lib/src/native/popover';
|
export * from 'doric/lib/src/native/popover';
|
||||||
export * from 'doric/lib/src/native/animate';
|
export * from 'doric/lib/src/native/animate';
|
||||||
|
export * from 'doric/lib/src/native/notification';
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module 'doric/lib/src/util/index.util' {
|
declare module 'doric/lib/src/util/index.util' {
|
||||||
@ -792,6 +793,25 @@ declare module 'doric/lib/src/native/animate' {
|
|||||||
}) => Promise<any>;
|
}) => Promise<any>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
declare module 'doric/lib/src/native/notification' {
|
||||||
|
import { BridgeContext } from "doric/lib/src/runtime/global";
|
||||||
|
export function notification(context: BridgeContext): {
|
||||||
|
publish: (args: {
|
||||||
|
biz: string;
|
||||||
|
name: string;
|
||||||
|
data?: object | undefined;
|
||||||
|
androidSystem?: boolean | undefined;
|
||||||
|
}) => Promise<any>;
|
||||||
|
subscribe: (args: {
|
||||||
|
biz: string;
|
||||||
|
name: string;
|
||||||
|
callback: (data?: any) => void;
|
||||||
|
androidSystem?: boolean | undefined;
|
||||||
|
}) => Promise<string>;
|
||||||
|
unsubscribe: (subscribeId: string) => Promise<any>;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
declare module 'doric/lib/src/util/color' {
|
declare module 'doric/lib/src/util/color' {
|
||||||
import { Modeling } from "doric/lib/src/util/types";
|
import { Modeling } from "doric/lib/src/util/types";
|
||||||
/**
|
/**
|
||||||
|
1
doric-js/lib/src/native/index.native.d.ts
vendored
1
doric-js/lib/src/native/index.native.d.ts
vendored
@ -5,3 +5,4 @@ export * from './network';
|
|||||||
export * from './storage';
|
export * from './storage';
|
||||||
export * from './popover';
|
export * from './popover';
|
||||||
export * from './animate';
|
export * from './animate';
|
||||||
|
export * from './notification';
|
||||||
|
@ -20,3 +20,4 @@ export * from './network';
|
|||||||
export * from './storage';
|
export * from './storage';
|
||||||
export * from './popover';
|
export * from './popover';
|
||||||
export * from './animate';
|
export * from './animate';
|
||||||
|
export * from './notification';
|
||||||
|
2
doric-js/lib/src/native/notification.d.ts
vendored
2
doric-js/lib/src/native/notification.d.ts
vendored
@ -9,7 +9,7 @@ export declare function notification(context: BridgeContext): {
|
|||||||
subscribe: (args: {
|
subscribe: (args: {
|
||||||
biz: string;
|
biz: string;
|
||||||
name: string;
|
name: string;
|
||||||
callback: (data?: object | undefined) => void;
|
callback: (data?: any) => void;
|
||||||
androidSystem?: boolean | undefined;
|
androidSystem?: boolean | undefined;
|
||||||
}) => Promise<string>;
|
}) => Promise<string>;
|
||||||
unsubscribe: (subscribeId: string) => Promise<any>;
|
unsubscribe: (subscribeId: string) => Promise<any>;
|
||||||
|
Reference in New Issue
Block a user