WXSDKEngine.h
5.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/
#import <Foundation/Foundation.h>
@class WXSDKInstance;
@interface WXSDKEngine : NSObject
/**
* @abstract Register default modules/components/handlers, they will be registered only once.
**/
+ (void)registerDefaults;
/**
* @abstract Register a module for a given name
*
* @param name The module name to register
*
* @param clazz The module class to register
*
**/
+ (void)registerModule:(NSString *)name withClass:(Class)clazz;
/**
* @abstract Registers a component for a given name
*
* @param name The component name to register
*
* @param clazz The WXComponent subclass to register
*
**/
+ (void)registerComponent:(NSString *)name withClass:(Class)clazz;
/**
* @abstract Registers a extendCallNative Class for a given name
*
* @param name The extendCallNative name to register
*
* @param clazz The extendCallNative subclass to register
*
**/
+ (void)registerExtendCallNative:(NSString *)name withClass:(Class)clazz;
/**
* @abstract Registers a component for a given name and specific properties
*
* @param name The component name to register
*
* @param clazz The WXComponent subclass to register
*
* @param properties properties to apply to the component
*
*/
+ (void)registerComponent:(NSString *)name withClass:(Class)clazz withProperties:(NSDictionary *)properties;
/**
* @abstract Registers a component for a given name, options and js code
*
* @param name The service name to register
*
* @param options The service options to register
*
* @param serviceScript service js code to invoke
*
*/
+ (void)registerService:(NSString *)name withScript:(NSString *)serviceScript withOptions:(NSDictionary *)options;
/**
* @abstract Registers a component for a given name, options and js code
*
* @param name The service name to register
*
* @param options The service options to register
*
* @param serviceScript service js code to invoke
*
* @param completion Completion callback. JS is executed in asynchronously.
*
*/
+ (void)registerService:(NSString *)name withScript:(NSString *)serviceScript withOptions:(NSDictionary *)options completion:(void(^)(BOOL result))completion;
/**
* @abstract Registers a component for a given name, options and js url
*
* @param name The service name to register
*
* @param options The service options to register
*
* @param serviceScriptUrl The service url to register
*
*/
+ (void)registerService:(NSString *)name withScriptUrl:(NSURL *)serviceScriptUrl withOptions:(NSDictionary *)options;
/**
* @abstract Registers a component for a given name, options and js url
*
* @param name The service name to register
*
* @param options The service options to register
*
* @param serviceScriptUrl The service url to register
*
* @param completion Completion callback. JS is executed in asynchronously.
*
*/
+ (void)registerService:(NSString *)name withScriptUrl:(NSURL *)serviceScriptUrl withOptions:(NSDictionary *)options completion:(void(^)(BOOL result))completion;
/**
* @abstract Registers a component for a given name, options and js code
*
* @param name The name of register service
*
*/
+ (void)unregisterService:(NSString *)name;
/**
* @abstract Registers a handler for a given handler instance and specific protocol
*
* @param handler The handler instance to register
*
* @param protocol The protocol to confirm
*
*/
+ (void)registerHandler:(id)handler withProtocol:(Protocol *)protocol;
/**
* @abstract Returns a given handler instance for specific protocol
*
* @param protocol The protocol to confirm
*
*/
+ (id)handlerForProtocol:(Protocol *)protocol;
/**
* @abstract Initializes the global sdk environment
*
* @discussion Injects main.js in app bundle as default JSFramework script.
*
**/
+ (void)initSDKEnvironment;
/**
* @abstract Initializes the environment with a given JSFramework script.
*
**/
+ (void)initSDKEnvironment:(NSString *)script;
/**
* @abstract Unloads the bridge context
*
**/
+ (void)unload;
/**
* @abstract restart Weex Engine.
**/
+ (void)restart;
/**
* @abstract restart Weex Engine with specify jsfm.
**/
+ (void)restartWithScript:(NSString*)script;
/**
* @abstract Returns the version of SDK
*
**/
+ (NSString*)SDKEngineVersion;
/**
* @abstract The Instance at the top of the rendering stack.
*
**/
+ (WXSDKInstance *)topInstance;
/**
* @abstract Add custom environment variables
* @discuss These variables can be obtained by $getConfig().env
*
**/
+ (void)setCustomEnvironment:(NSDictionary *)environment;
+ (NSDictionary *)customEnvironment;
/**
* @abstract Connects to websocket for collecting log
*
* @param URL The URL of websocket to connect
*
*/
+ (void)connectDebugServer:(NSString*)URL;
/**
* @abstract Connects to websocket for devtool debug
*
* @param URL The URL of websocket to connect
*
*/
+ (void)connectDevToolServer:(NSString *)URL;
@end
@interface WXSDKEngine (Deprecated)
+ (void)initSDKEnviroment DEPRECATED_MSG_ATTRIBUTE("To fix typo, use initSDKEnvironment method instead.");
+ (void)initSDKEnviroment:(NSString *)script DEPRECATED_MSG_ATTRIBUTE("To fix typo, use initSDKEnvironment: method instead.");
@end