123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- #import <JavaScriptCore/JavaScriptCore.h>
- typedef NSInteger(^WXJSCallNative)(NSString *instance, NSArray *tasks, NSString *callback);
- typedef NSInteger(^WXJSCallAddElement)(NSString *instanceId, NSString *parentRef, NSDictionary *elementData, NSInteger index);
- typedef NSInteger(^WXJSCallCreateBody)(NSString *instanceId, NSDictionary *bodyData);
- typedef NSInteger(^WXJSCallRemoveElement)(NSString *instanceId,NSString *ref);
- typedef NSInteger(^WXJSCallMoveElement)(NSString *instanceId,NSString *ref,NSString *parentRef,NSInteger index);
- typedef NSInteger(^WXJSCallUpdateAttrs)(NSString *instanceId,NSString *ref,NSDictionary *attrsData);
- typedef NSInteger(^WXJSCallUpdateStyle)(NSString *instanceId,NSString *ref,NSDictionary *stylesData);
- typedef NSInteger(^WXJSCallAddEvent)(NSString *instanceId,NSString *ref,NSString *event);
- typedef NSInteger(^WXJSCallRemoveEvent)(NSString *instanceId,NSString *ref,NSString *event);
- typedef NSInteger(^WXJSCallCreateFinish)(NSString *instanceId);
- typedef NSInteger(^WXJSCallRefreshFinish)(NSString *instanceId);
- typedef NSInteger(^WXJSCallUpdateFinish)(NSString *instanceId);
- typedef NSInvocation *(^WXJSCallNativeModule)(NSString *instanceId, NSString *moduleName, NSString *methodName, NSArray *args, NSDictionary *options);
- typedef void (^WXJSCallNativeComponent)(NSString *instanceId, NSString *componentRef, NSString *methodName, NSArray *args, NSDictionary *options);
- @protocol WXBridgeProtocol <NSObject>
- @property (nonatomic, readonly) JSValue* exception;
- - (void)executeJSFramework:(NSString *)frameworkScript;
- - (void)executeJavascript:(NSString *)script;
- - (JSValue *)callJSMethod:(NSString *)method args:(NSArray*)args;
- - (void)resetEnvironment;
- @optional
- -(void)removeTimers:(NSString *)instance;
- - (void)garbageCollect;
- @required
- - (void)registerCallNative:(WXJSCallNative)callNative;
- - (void)registerCallAddElement:(WXJSCallAddElement)callAddElement;
- - (void)registerCallCreateBody:(WXJSCallCreateBody)callCreateBody;
- - (void)registerCallRemoveElement:(WXJSCallRemoveElement)callRemoveElement;
- - (void)registerCallMoveElement:(WXJSCallMoveElement)callMoveElement;
- - (void)registerCallUpdateAttrs:(WXJSCallUpdateAttrs)callUpdateAttrs;
- - (void)registerCallUpdateStyle:(WXJSCallUpdateStyle)callUpdateStyle;
- - (void)registerCallAddEvent:(WXJSCallAddEvent)callAddEvent;
- - (void)registerCallRemoveEvent:(WXJSCallRemoveEvent)callRemoveEvent;
- - (void)registerCallCreateFinish:(WXJSCallCreateFinish)callCreateFinish;
- - (void)registerCallNativeModule:(WXJSCallNativeModule)callNativeModuleBlock;
- - (void)registerCallNativeComponent:(WXJSCallNativeComponent)callNativeComponentBlock;
- @optional
- - (void)registerCallRefreshFinish:(WXJSCallRefreshFinish)callRefreshFinish;
- - (void)registerCallUpdateFinish:(WXJSCallUpdateFinish)callUpdateFinish;
- - (JSValue *)executeJavascript:(NSString *)script withSourceURL:(NSURL*)sourceURL;
- @property (nonatomic, strong) NSString* weexInstanceId;
- - (void)setJSContext:(JSContext*)context;
- - (JSContext*)javaScriptContext;
- @end
|