catchword 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +314 -2
- package/bin/catchword.js +8 -0
- package/bin/falcon.js +5 -0
- package/dist/cli/adb.d.ts +6 -0
- package/dist/cli/adb.js +52 -0
- package/dist/cli/audit.d.ts +4 -0
- package/dist/cli/audit.js +91 -0
- package/dist/cli/build.d.ts +13 -0
- package/dist/cli/build.js +139 -0
- package/dist/cli/clean.d.ts +1 -0
- package/dist/cli/clean.js +15 -0
- package/dist/cli/create.d.ts +4 -0
- package/dist/cli/create.js +60 -0
- package/dist/cli/dev.d.ts +10 -0
- package/dist/cli/dev.js +23 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.js +243 -0
- package/dist/cli/native.d.ts +18 -0
- package/dist/cli/native.js +232 -0
- package/dist/cli/simulator.d.ts +8 -0
- package/dist/cli/simulator.js +77 -0
- package/dist/cli/upload.d.ts +9 -0
- package/dist/cli/upload.js +135 -0
- package/dist/cli/util.d.ts +8 -0
- package/dist/cli/util.js +43 -0
- package/dist/config.d.ts +17 -0
- package/dist/config.js +90 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +51 -0
- package/dist/native/api.d.ts +46 -0
- package/dist/native/api.js +185 -0
- package/dist/native/build.d.ts +47 -0
- package/dist/native/build.js +407 -0
- package/dist/native/elf.d.ts +15 -0
- package/dist/native/elf.js +200 -0
- package/dist/native/types.d.ts +9 -0
- package/dist/native/types.js +91 -0
- package/dist/native/wsl.d.ts +7 -0
- package/dist/native/wsl.js +29 -0
- package/dist/plugin/app-entry.d.ts +6 -0
- package/dist/plugin/app-entry.js +115 -0
- package/dist/plugin/assets.d.ts +4 -0
- package/dist/plugin/assets.js +84 -0
- package/dist/plugin/config.d.ts +14 -0
- package/dist/plugin/config.js +80 -0
- package/dist/plugin/context.d.ts +58 -0
- package/dist/plugin/context.js +255 -0
- package/dist/plugin/fallback.d.ts +4 -0
- package/dist/plugin/fallback.js +81 -0
- package/dist/plugin/image-service.d.ts +17 -0
- package/dist/plugin/image-service.js +138 -0
- package/dist/plugin/jsapi.d.ts +6 -0
- package/dist/plugin/jsapi.js +82 -0
- package/dist/plugin/output.d.ts +4 -0
- package/dist/plugin/output.js +75 -0
- package/dist/plugin/preview.d.ts +34 -0
- package/dist/plugin/preview.js +459 -0
- package/dist/plugin/sanitize.d.ts +5 -0
- package/dist/plugin/sanitize.js +48 -0
- package/dist/plugin/security.d.ts +4 -0
- package/dist/plugin/security.js +18 -0
- package/dist/plugin/sfc.d.ts +6 -0
- package/dist/plugin/sfc.js +181 -0
- package/dist/plugin/shim.d.ts +4 -0
- package/dist/plugin/shim.js +68 -0
- package/dist/plugin/state.d.ts +31 -0
- package/dist/plugin/state.js +61 -0
- package/dist/plugin/string-table.d.ts +7 -0
- package/dist/plugin/string-table.js +324 -0
- package/dist/plugin/style.d.ts +15 -0
- package/dist/plugin/style.js +114 -0
- package/dist/plugin/template.d.ts +7 -0
- package/dist/plugin/template.js +39 -0
- package/dist/steps/manifest.d.ts +9 -0
- package/dist/steps/manifest.js +60 -0
- package/dist/steps/pack.d.ts +3 -0
- package/dist/steps/pack.js +46 -0
- package/dist/steps/qjsc.d.ts +9 -0
- package/dist/steps/qjsc.js +186 -0
- package/dist/steps/report.d.ts +2 -0
- package/dist/steps/report.js +50 -0
- package/dist/steps/security.d.ts +17 -0
- package/dist/steps/security.js +310 -0
- package/dist/types.d.ts +158 -0
- package/dist/types.js +1 -0
- package/dist/util/class-tokenize.d.ts +2 -0
- package/dist/util/class-tokenize.js +56 -0
- package/dist/util/component-name.d.ts +6 -0
- package/dist/util/component-name.js +120 -0
- package/dist/util/fs.d.ts +14 -0
- package/dist/util/fs.js +70 -0
- package/dist/util/imports.d.ts +2 -0
- package/dist/util/imports.js +173 -0
- package/dist/util/log.d.ts +8 -0
- package/dist/util/log.js +24 -0
- package/package.json +61 -4
- package/template/README.md +38 -0
- package/template/catchword.config.ts +18 -0
- package/template/native/CMakeLists.txt +33 -0
- package/template/native/README.md +34 -0
- package/template/native/api.override.json +7 -0
- package/template/native/include/jsapi_demo.h +10 -0
- package/template/native/lib/README.md +10 -0
- package/template/native/sdk/README.md +6 -0
- package/template/native/src/bridge.cpp +9 -0
- package/template/native/src/jsapi_demo.cpp +11 -0
- package/template/package.json +38 -0
- package/template/src/app.js +45 -0
- package/template/src/app.json +11 -0
- package/template/src/base-page.js +150 -0
- package/template/src/components/HelloWorld.vue +20 -0
- package/template/src/mocks/$jsapi.test.js +5 -0
- package/template/src/mocks/test-module.js +5 -0
- package/template/src/pages/index/index.vue +41 -0
- package/template/src/pages/page/page.vue +63 -0
- package/template/src/shims.d.ts +21 -0
- package/template/src/styles/base.less +23 -0
- package/template/src/styles/mixin.less +32 -0
- package/template/src/styles/var.less +15 -0
- package/template/tsconfig.json +14 -0
- package/vendor/README.md +16 -0
- package/vendor/falcon-styler/.jscsrc +31 -0
- package/vendor/falcon-styler/LICENSE +21 -0
- package/vendor/falcon-styler/README.md +124 -0
- package/vendor/falcon-styler/index.js +273 -0
- package/vendor/falcon-styler/lib/shorthand-parser.js +78 -0
- package/vendor/falcon-styler/lib/util.js +30 -0
- package/vendor/falcon-styler/lib/validator.js +846 -0
- package/vendor/falcon-styler/package.json +32 -0
- package/vendor/licenses/falcon-styler.LICENSE +21 -0
- package/vendor/licenses/weex-template-compiler.README.md +3 -0
- package/vendor/package.json +5 -0
- package/vendor/qjsc/SHA256SUMS +11 -0
- package/vendor/qjsc/bin/darwin/arm64/qjsc20200705 +0 -0
- package/vendor/qjsc/bin/darwin/x64/qjsc20200412 +0 -0
- package/vendor/qjsc/bin/darwin/x64/qjsc20200705 +0 -0
- package/vendor/qjsc/bin/darwin/x64/qjsc20200906 +0 -0
- package/vendor/qjsc/bin/darwin/x64/qjscbn20200412 +0 -0
- package/vendor/qjsc/bin/darwin/x64/qjscbn20200705 +0 -0
- package/vendor/qjsc/bin/darwin/x64/qjscbn20200906 +0 -0
- package/vendor/qjsc/bin/linux/qjsc20200705 +0 -0
- package/vendor/qjsc/bin/win32/libgcc_s_dw2-1.dll +0 -0
- package/vendor/qjsc/bin/win32/pthreadGC-3.dll +0 -0
- package/vendor/qjsc/bin/win32/qjsc20200705.exe +0 -0
- package/vendor/web/falcon-js-web.js +863 -0
- package/vendor/web/falcon-jsapi-web.js +479 -0
- package/vendor/web/falcon-vue-render.js +11323 -0
- package/vendor/web/falcon-web-boot.js +4 -0
- package/vendor/web/falcon-web-hud.js +119 -0
- package/vendor/web/falcon-web-style.js +235 -0
- package/vendor/web/vue.runtime.common.dev.js +8467 -0
- package/vendor/web/vue.runtime.common.js +5 -0
- package/vendor/weex-template-compiler/README.md +3 -0
- package/vendor/weex-template-compiler/build.js +4824 -0
- package/vendor/weex-template-compiler/index.js +17 -0
- package/vendor/weex-template-compiler/package.json +25 -0
|
@@ -0,0 +1,863 @@
|
|
|
1
|
+
|
|
2
|
+
const FALCON_IGNORE_ELEMENTS = ['modal', 'seekbar'];
|
|
3
|
+
|
|
4
|
+
function applyIgnoreElements(Vue) {
|
|
5
|
+
const ignoreElements = Vue.config.ignoredElements || [];
|
|
6
|
+
Vue.config.ignoredElements = [...ignoreElements, ...FALCON_IGNORE_ELEMENTS];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
let _id = 0;
|
|
10
|
+
function getPageId() {
|
|
11
|
+
return ++_id;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
class PageManager {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.pageStack = [];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
front(pageName) {
|
|
20
|
+
const index = this.pageStack.findIndex((name) => name === pageName);
|
|
21
|
+
if (index === -1) {
|
|
22
|
+
this.pageStack.push(pageName);
|
|
23
|
+
} else {
|
|
24
|
+
const current = this.pageStack.splice(index, 1)[0];
|
|
25
|
+
this.pageStack.push(current);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
top() {
|
|
29
|
+
return this.pageStack[this.pageStack.length - 1];
|
|
30
|
+
}
|
|
31
|
+
pop() {
|
|
32
|
+
return this.pageStack.pop();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
remove(pageName) {
|
|
36
|
+
const index = this.pageStack.findIndex((name) => name === pageName);
|
|
37
|
+
if (index !== -1) {
|
|
38
|
+
return this.pageStack.splice(index, 1);
|
|
39
|
+
}
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
clear() {
|
|
43
|
+
this.pageStack = [];
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const pageMgr = new PageManager();
|
|
48
|
+
|
|
49
|
+
const driver = {
|
|
50
|
+
// mapping native $falcon.loadPage
|
|
51
|
+
_web_boot_page: function (PageClass, Vue, subWindow) {
|
|
52
|
+
if (PageClass.__esModule === true) {
|
|
53
|
+
PageClass = PageClass.default;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
applyIgnoreElements(Vue);
|
|
57
|
+
|
|
58
|
+
const pageName = subWindow.$pageName;
|
|
59
|
+
const wxInstance = subWindow.weex;
|
|
60
|
+
|
|
61
|
+
const profile = subWindow.__FALCON_PROFILE__ || null;
|
|
62
|
+
const designWidth = (profile && profile.viewport) || subWindow.$falcon.env.deviceWidth;
|
|
63
|
+
wxInstance.requireModule('meta').setViewport({
|
|
64
|
+
width: designWidth,
|
|
65
|
+
height: subWindow.$falcon.env.deviceHeight
|
|
66
|
+
});
|
|
67
|
+
const options = subWindow.$falcon_pageOptions || {};
|
|
68
|
+
const instanceId = getPageId();
|
|
69
|
+
this.__loadPage(PageClass, pageName, wxInstance, instanceId, Vue, options);
|
|
70
|
+
|
|
71
|
+
this._performPageLifeCycle(instanceId, 'onShow', options, 'show');
|
|
72
|
+
|
|
73
|
+
subWindow.$falcon_page = this._pageMap.get(instanceId);
|
|
74
|
+
},
|
|
75
|
+
navTo: function (page, options) {
|
|
76
|
+
if (page.indexOf('://') !== -1) {
|
|
77
|
+
console.error('unsupport nav to app on web,please try on device!');
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const main = document.querySelector('#main');
|
|
81
|
+
const iframes = main.querySelectorAll('iframe');
|
|
82
|
+
let find = false;
|
|
83
|
+
for (let i = 0; i < iframes.length; i++) {
|
|
84
|
+
const iframe = iframes[i];
|
|
85
|
+
const pageName = iframe.getAttribute('id');
|
|
86
|
+
const falconPage = iframe.contentWindow.$falcon_page;
|
|
87
|
+
const pageId = (falconPage && falconPage.$pageId) || '';
|
|
88
|
+
if (pageName === page) {
|
|
89
|
+
find = true;
|
|
90
|
+
iframe.style = '';
|
|
91
|
+
if (!iframe.$falcon_current) {
|
|
92
|
+
$falcon.showPage(pageId);
|
|
93
|
+
$falcon.newPageOptions(pageId, options);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
iframe.$falcon_current = true;
|
|
97
|
+
} else {
|
|
98
|
+
iframe.style = 'display:none';
|
|
99
|
+
if (iframe.$falcon_current) {
|
|
100
|
+
$falcon.hidePage(pageId);
|
|
101
|
+
}
|
|
102
|
+
iframe.$falcon_current = false;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (!find && page) {
|
|
106
|
+
const iframe = document.createElement('iframe');
|
|
107
|
+
iframe.onload = () => {
|
|
108
|
+
const styles = document.querySelectorAll('style');
|
|
109
|
+
styles.forEach((style) => {
|
|
110
|
+
const subDocument = iframe.contentWindow.document;
|
|
111
|
+
const styNode = subDocument.createElement('style');
|
|
112
|
+
styNode.type = 'text/css';
|
|
113
|
+
styNode.innerHTML = style.innerHTML;
|
|
114
|
+
subDocument.querySelector('head').appendChild(styNode);
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
iframe.src = page + '.html';
|
|
119
|
+
iframe.setAttribute('frameborder', '0');
|
|
120
|
+
iframe.setAttribute('id', page);
|
|
121
|
+
main.appendChild(iframe);
|
|
122
|
+
iframe.$falcon_current = true;
|
|
123
|
+
iframe.contentWindow.$falcon = this;
|
|
124
|
+
iframe.contentWindow.$falcon_pageOptions = options;
|
|
125
|
+
iframe.contentWindow.$pageName = page;
|
|
126
|
+
iframe.contentWindow.addEventListener('keyup', (evt) => {
|
|
127
|
+
if (evt.key === 'Escape') {
|
|
128
|
+
const topPageName = pageMgr.top();
|
|
129
|
+
$falcon.closePageByName(topPageName);
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
if (page) {
|
|
134
|
+
window.location.hash = 'page=' + page;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
pageMgr.front(page);
|
|
138
|
+
},
|
|
139
|
+
closeApp(appId) {
|
|
140
|
+
$falcon.hideApp();
|
|
141
|
+
$falcon.destroyApp();
|
|
142
|
+
|
|
143
|
+
const main = document.querySelector('#main');
|
|
144
|
+
main.innerHTML = '';
|
|
145
|
+
pageMgr.clear();
|
|
146
|
+
},
|
|
147
|
+
|
|
148
|
+
closePageByName(pageName) {
|
|
149
|
+
const main = document.querySelector('#main');
|
|
150
|
+
const iframe = document.querySelector('#' + pageName);
|
|
151
|
+
const isTop = pageMgr.top() === pageName;
|
|
152
|
+
if (iframe) {
|
|
153
|
+
const page = iframe.contentWindow.$falcon_page;
|
|
154
|
+
const pageId = page.$pageId;
|
|
155
|
+
if (isTop) {
|
|
156
|
+
$falcon.hidePage(pageId);
|
|
157
|
+
}
|
|
158
|
+
$falcon.unloadPage(pageId);
|
|
159
|
+
main.removeChild(iframe);
|
|
160
|
+
pageMgr.remove(pageName);
|
|
161
|
+
|
|
162
|
+
if (isTop) {
|
|
163
|
+
const nextPageName = pageMgr.top();
|
|
164
|
+
const nextIframe = document.querySelector('#' + nextPageName);
|
|
165
|
+
if (nextIframe) {
|
|
166
|
+
nextIframe.style = '';
|
|
167
|
+
const nextPage = nextIframe.contentWindow.$falcon_page;
|
|
168
|
+
$falcon.showPage(nextPage);
|
|
169
|
+
window.location.hash = 'page=' + nextPageName;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
} else {
|
|
173
|
+
console.warn(`cant't find page:${pageName} on close`);
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
|
|
177
|
+
closePageById(instanceId) {
|
|
178
|
+
const page = this._pageMap.get(instanceId);
|
|
179
|
+
this.closePageByName(page.$pageName);
|
|
180
|
+
},
|
|
181
|
+
|
|
182
|
+
_apply_page_mode(page, wxInstance) {
|
|
183
|
+
['dom', 'animation'].forEach((mod) => {
|
|
184
|
+
const modName = `$${mod}`;
|
|
185
|
+
if (page[modName]) {
|
|
186
|
+
console.warn(`module conflict:${modName}`);
|
|
187
|
+
} else {
|
|
188
|
+
page[modName] = wxInstance.requireModule(mod);
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
const SCHEMA = 'falcon';
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
const REG_URI = /^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+)(?::(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/;
|
|
199
|
+
const REG_GROUPS = ['url', 'scheme', 'slash', 'host', 'port', 'path', 'query', 'hash'];
|
|
200
|
+
|
|
201
|
+
const QUERY_REG = /([^=&\s]+)[=\s]*([^&\s]*)/g;
|
|
202
|
+
|
|
203
|
+
var Util = {
|
|
204
|
+
getDlogFun(tag) {
|
|
205
|
+
return function () { };
|
|
206
|
+
},
|
|
207
|
+
|
|
208
|
+
parseQuery(query) {
|
|
209
|
+
const obj = {};
|
|
210
|
+
while (QUERY_REG.exec(query)) {
|
|
211
|
+
obj[RegExp.$1] = RegExp.$2;
|
|
212
|
+
}
|
|
213
|
+
return obj;
|
|
214
|
+
},
|
|
215
|
+
|
|
216
|
+
parseUri(uri) {
|
|
217
|
+
const matches = REG_URI.exec(uri);
|
|
218
|
+
const result = {};
|
|
219
|
+
REG_GROUPS.forEach((key, index) => {
|
|
220
|
+
const match = matches[index];
|
|
221
|
+
if (match) {
|
|
222
|
+
if (key === 'query' || key === 'hash') {
|
|
223
|
+
result[key] = this.parseQuery(match);
|
|
224
|
+
} else {
|
|
225
|
+
result[key] = match;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
return result
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
class FalconEvent {
|
|
234
|
+
constructor() {
|
|
235
|
+
this.eventMap = {};
|
|
236
|
+
this._uniqueId = 0;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
register(name, callback) {
|
|
240
|
+
if (!this.eventMap[name]) {
|
|
241
|
+
this.eventMap[name] = [];
|
|
242
|
+
}
|
|
243
|
+
const id = ++this._uniqueId;
|
|
244
|
+
this.eventMap[name].push({
|
|
245
|
+
callback,
|
|
246
|
+
id
|
|
247
|
+
});
|
|
248
|
+
return id;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
unRegister(name, callback) {
|
|
252
|
+
const evtList = this.eventMap[name];
|
|
253
|
+
if (evtList) {
|
|
254
|
+
if (callback) {
|
|
255
|
+
const index = evtList.findIndex(item => item.callback === callback || item.id === callback);
|
|
256
|
+
if (index !== -1) {
|
|
257
|
+
evtList.splice(index, 1);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
if (evtList.length === 0) {
|
|
261
|
+
delete this.eventMap[name];
|
|
262
|
+
}
|
|
263
|
+
} else {
|
|
264
|
+
delete this.eventMap[name];
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
trigger(name, options) {
|
|
270
|
+
let listeners = this.eventMap[name];
|
|
271
|
+
if (listeners && listeners.length !== 0) {
|
|
272
|
+
const data = {
|
|
273
|
+
type: name,
|
|
274
|
+
timestamp: Date.now(),
|
|
275
|
+
data: options || {}
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
listeners = listeners.slice();
|
|
279
|
+
listeners.forEach(l => {
|
|
280
|
+
l && l.callback && l.callback(data);
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
on(name, callback) {
|
|
286
|
+
return this.register(name, callback);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
off(name, callback) {
|
|
290
|
+
this.unRegister(name, callback);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
const dog$1 = Util.getDlogFun('App');
|
|
296
|
+
|
|
297
|
+
class App extends FalconEvent {
|
|
298
|
+
onLaunch(options) {
|
|
299
|
+
this.launchOptions = options;
|
|
300
|
+
dog$1(`onLaunch:${JSON.stringify(options)}`);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
onShow() {
|
|
304
|
+
dog$1(`onShow`);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
onHide() {
|
|
308
|
+
dog$1(`onHide`);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
onDestroy() {
|
|
312
|
+
dog$1(`onDestroy`);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
onError(error) {
|
|
316
|
+
dog$1(`onError:${error.message},${error.stack}`);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
finish() {
|
|
320
|
+
this.$falcon.closeApp();
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
setViewPort(viewPort) {
|
|
324
|
+
this.viewPort = viewPort;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
const dog = Util.getDlogFun('Page');
|
|
330
|
+
|
|
331
|
+
class Page extends FalconEvent {
|
|
332
|
+
setRootComponent(Component) {
|
|
333
|
+
if (this._component) {
|
|
334
|
+
throw new Error('root component has set!');
|
|
335
|
+
}
|
|
336
|
+
this._component = Component;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
onLoad(options) {
|
|
340
|
+
this.loadOptions = options;
|
|
341
|
+
dog(`onLoad:${JSON.stringify(options)},instance:${this.$pageId}`);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
onNewOptions(options) {
|
|
345
|
+
this.newOptions = options;
|
|
346
|
+
dog(`onNewOptions:${JSON.stringify(options)},instance:${this.$pageId}`);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
onShow() {
|
|
350
|
+
dog(`onShow,instance:${this.$pageId}`);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
onHide() {
|
|
354
|
+
dog(`onHide,instance:${this.$pageId}`);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
onUnload() {
|
|
358
|
+
dog(`onUnload,instance:${this.$pageId}`);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
finish() {
|
|
362
|
+
this.$falcon.closePageById(this.$pageId);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
class FalconModule extends FalconEvent {
|
|
368
|
+
constructor(name) {
|
|
369
|
+
super();
|
|
370
|
+
this.name = name;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
const SCHEMA_STARTS = `${SCHEMA}://`;
|
|
376
|
+
|
|
377
|
+
function _promisefy(fn) {
|
|
378
|
+
return function (options, callback) {
|
|
379
|
+
return new Promise(function (resolve) {
|
|
380
|
+
fn(options, function (result) {
|
|
381
|
+
callback && callback(result);
|
|
382
|
+
resolve(result);
|
|
383
|
+
});
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
const JSAPI = {
|
|
389
|
+
navTo(target, options, ...params) {
|
|
390
|
+
if (!target) {
|
|
391
|
+
console.error('$falcon.navTo(target) error, params target is null or empty!');
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
if (target.startsWith(SCHEMA_STARTS)) {
|
|
395
|
+
const uri = Util.parseUri(target);
|
|
396
|
+
let query = uri.query || {};
|
|
397
|
+
if (options) {
|
|
398
|
+
query = Object.assign(query, options);
|
|
399
|
+
}
|
|
400
|
+
const args = [uri.host, uri.path, query];
|
|
401
|
+
this.__NAVIGATOR.navToApp.apply(this.__NAVIGATOR, args.concat(params));
|
|
402
|
+
} else {
|
|
403
|
+
const args = [target, options];
|
|
404
|
+
this.__NAVIGATOR.navToPage.apply(this.__NAVIGATOR, args.concat(params));
|
|
405
|
+
}
|
|
406
|
+
},
|
|
407
|
+
|
|
408
|
+
closeApp(appId) {
|
|
409
|
+
this.__NAVIGATOR.closeApp(appId);
|
|
410
|
+
},
|
|
411
|
+
|
|
412
|
+
closePageByName(page) {
|
|
413
|
+
this.__NAVIGATOR.closePageByName(page);
|
|
414
|
+
},
|
|
415
|
+
|
|
416
|
+
closePageById(instanceId) {
|
|
417
|
+
this.__NAVIGATOR.closePageById(instanceId);
|
|
418
|
+
},
|
|
419
|
+
|
|
420
|
+
__applyTo(obj) {
|
|
421
|
+
for (const key in JSAPI) {
|
|
422
|
+
if (key !== '__applyTo' && key !== '__modular') {
|
|
423
|
+
obj[key] = JSAPI[key];
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
},
|
|
427
|
+
|
|
428
|
+
__modular(obj) {
|
|
429
|
+
const modules = [];
|
|
430
|
+
obj && Object.keys(obj).forEach((apiName) => {
|
|
431
|
+
const fn = obj[apiName];
|
|
432
|
+
if (typeof fn === 'function') {
|
|
433
|
+
const sep = apiName.split('.');
|
|
434
|
+
if (sep.length > 1) {
|
|
435
|
+
let current = obj;
|
|
436
|
+
let currentModuleName = '';
|
|
437
|
+
for (let i = 0; i < sep.length; i++) {
|
|
438
|
+
const key = sep[i];
|
|
439
|
+
if (i !== sep.length - 1) {
|
|
440
|
+
if (current[key] === undefined) {
|
|
441
|
+
const module = new FalconModule(currentModuleName + key);
|
|
442
|
+
current[key] = module;
|
|
443
|
+
modules.push(module);
|
|
444
|
+
} else {
|
|
445
|
+
if (!(current[key] instanceof FalconModule)) {
|
|
446
|
+
throw Error(`conflict moduleName: ${key}, api:${apiName}`);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
current = current[sep[i]];
|
|
450
|
+
currentModuleName = key + '.';
|
|
451
|
+
} else {
|
|
452
|
+
if (current[key] === undefined) {
|
|
453
|
+
current[key] = _promisefy(fn);
|
|
454
|
+
} else {
|
|
455
|
+
throw new Error(`conflict jsapi:${apiName}`);
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
return modules;
|
|
463
|
+
}
|
|
464
|
+
};
|
|
465
|
+
|
|
466
|
+
function falconPluginFactory (falcon, app, page, wxInstance, instanceId) {
|
|
467
|
+
let ctors = [];
|
|
468
|
+
return {
|
|
469
|
+
install(Vue) {
|
|
470
|
+
Vue.prototype.$instanceId = instanceId;
|
|
471
|
+
Vue.prototype.$document = wxInstance.weex ? wxInstance.weex.document : wxInstance.document;
|
|
472
|
+
Vue.prototype.$requireWeexModule = wxInstance.requireModule;
|
|
473
|
+
Vue.prototype.$falcon = falcon;
|
|
474
|
+
Vue.prototype.$app = app;
|
|
475
|
+
Vue.prototype.$page = page;
|
|
476
|
+
|
|
477
|
+
Vue.mixin({
|
|
478
|
+
mounted() {
|
|
479
|
+
// root component (vm)
|
|
480
|
+
if (this.$root === this) {
|
|
481
|
+
const doc = this.$document;
|
|
482
|
+
if (doc && doc.taskCenter) {
|
|
483
|
+
try {
|
|
484
|
+
// Send "createFinish" signal to native.
|
|
485
|
+
doc.taskCenter.send('dom', { action: 'createFinish' }, []);
|
|
486
|
+
} catch (e) {
|
|
487
|
+
console.log(e.message, e.stack);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
},
|
|
492
|
+
|
|
493
|
+
beforeDestroy() {
|
|
494
|
+
if (this.constructor.extendOptions) {
|
|
495
|
+
ctors.push(this.constructor.extendOptions._Ctor);
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
if (this.constructor.options && this.constructor.options.components) {
|
|
499
|
+
const components = this.constructor.options.components;
|
|
500
|
+
if (components) {
|
|
501
|
+
for (const p in components) {
|
|
502
|
+
const ctor = components[p]._Ctor;
|
|
503
|
+
if (ctor) {
|
|
504
|
+
ctors.push(ctor);
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
if (this.$root === this) {
|
|
511
|
+
if (this.$options.components) {
|
|
512
|
+
const comps = this.$options.components;
|
|
513
|
+
for (const p in comps) {
|
|
514
|
+
const ctor = comps[p]._Ctor;
|
|
515
|
+
if (ctor) {
|
|
516
|
+
ctors.push(ctor);
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
},
|
|
522
|
+
destroyed() {
|
|
523
|
+
if (this === this.$root) {
|
|
524
|
+
const cid = this.$instanceId;
|
|
525
|
+
ctors.forEach((ctor) => {
|
|
526
|
+
// console.log('aabbcc ctor:', Object.keys(ctor));
|
|
527
|
+
delete ctor[cid];
|
|
528
|
+
});
|
|
529
|
+
ctors = null;
|
|
530
|
+
|
|
531
|
+
if (this.constructor.options && this.constructor.options.components) {
|
|
532
|
+
const components = this.constructor.options.components;
|
|
533
|
+
for (const p in components) {
|
|
534
|
+
if (typeof components[p].extendOptions === 'object') {
|
|
535
|
+
const ctor = components[p].extendOptions._Ctor;
|
|
536
|
+
if (ctor) {
|
|
537
|
+
delete ctor[cid];
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
});
|
|
545
|
+
|
|
546
|
+
/**
|
|
547
|
+
* @deprecated Just instance variable `weex.config`
|
|
548
|
+
* Get instance config.
|
|
549
|
+
* @return {object}
|
|
550
|
+
*/
|
|
551
|
+
Vue.prototype.$getConfig = function () {
|
|
552
|
+
const instance = this.$page._instance;
|
|
553
|
+
if (instance.app instanceof Vue) {
|
|
554
|
+
return instance.config
|
|
555
|
+
}
|
|
556
|
+
};
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
|
|
562
|
+
const COPYS_FROM_APPCONTEXT_TO_FALCON = [
|
|
563
|
+
'__NAVIGATOR', '__JSAPI'
|
|
564
|
+
];
|
|
565
|
+
|
|
566
|
+
// /**
|
|
567
|
+
// */
|
|
568
|
+
// const PRE_LOAD_PAGE_MODULE = [
|
|
569
|
+
// 'dom', 'animation'
|
|
570
|
+
// ];
|
|
571
|
+
|
|
572
|
+
const EVENT_REGEXP = /^(.+)\.([^.]+)$/;
|
|
573
|
+
class Falcon extends FalconEvent {
|
|
574
|
+
static initAppContext(gGlobal, instanceGlobal) {
|
|
575
|
+
// eslint-disable-next-line no-undef
|
|
576
|
+
const _falcon = new $_Falcon();
|
|
577
|
+
instanceGlobal.$falcon = _falcon;
|
|
578
|
+
_falcon.App = App;
|
|
579
|
+
_falcon.Page = Page;
|
|
580
|
+
|
|
581
|
+
COPYS_FROM_APPCONTEXT_TO_FALCON.forEach((prop) => {
|
|
582
|
+
_falcon[prop] = instanceGlobal[prop];
|
|
583
|
+
});
|
|
584
|
+
|
|
585
|
+
_falcon.jsapi = _falcon['__JSAPI'] || {};
|
|
586
|
+
var __webJsapi = instanceGlobal.__FALCON_JSAPI__;
|
|
587
|
+
if (__webJsapi) {
|
|
588
|
+
Object.keys(__webJsapi).forEach(function (name) {
|
|
589
|
+
if (_falcon.jsapi[name] === undefined) {
|
|
590
|
+
_falcon.jsapi[name] = __webJsapi[name];
|
|
591
|
+
}
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
_falcon.env = instanceGlobal.WXEnvironment;
|
|
596
|
+
_falcon.$_appInfo = instanceGlobal.$_appInfo;
|
|
597
|
+
|
|
598
|
+
JSAPI.__applyTo(_falcon);
|
|
599
|
+
try {
|
|
600
|
+
const modules = JSAPI.__modular(_falcon.jsapi);
|
|
601
|
+
_falcon._registerModule(modules);
|
|
602
|
+
} catch (e) {
|
|
603
|
+
console.log(e.message, e.stack);
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
useDefaultBasePageClass(BasePageClass) {
|
|
608
|
+
if (BasePageClass.prototype instanceof Page) {
|
|
609
|
+
this.Page = BasePageClass;
|
|
610
|
+
} else {
|
|
611
|
+
throw new Error('DefauBasePageClass must extend from $falcon.App');
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
constructor() {
|
|
616
|
+
super();
|
|
617
|
+
this.util = Util;
|
|
618
|
+
this._pageMap = new Map();
|
|
619
|
+
|
|
620
|
+
this._modules = new Map();
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
_registerModule(modules) {
|
|
624
|
+
if (!Array.isArray(modules)) {
|
|
625
|
+
modules = [modules];
|
|
626
|
+
}
|
|
627
|
+
modules.forEach((module) => {
|
|
628
|
+
this._modules.set(module.name, module);
|
|
629
|
+
});
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
|
|
633
|
+
_dispatchModuleEvent(name, options) {
|
|
634
|
+
if (name.indexOf('.') !== -1) {
|
|
635
|
+
const matchs = name.match(EVENT_REGEXP);
|
|
636
|
+
if (matchs && matchs[1] && matchs[2]) {
|
|
637
|
+
const moduleName = matchs[1];
|
|
638
|
+
const eventName = matchs[2];
|
|
639
|
+
if (this._modules.has(moduleName)) {
|
|
640
|
+
const module = this._modules.get(moduleName);
|
|
641
|
+
if (module) {
|
|
642
|
+
module.trigger(eventName, options);
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
trigger(name, options) {
|
|
650
|
+
super.trigger(name, options);
|
|
651
|
+
|
|
652
|
+
this._dispatchModuleEvent(name, options);
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
/* == app LifeCycle start ====== */
|
|
656
|
+
|
|
657
|
+
_performAppLifeCycle(lifeCycle, options, evtName) {
|
|
658
|
+
if (typeof this.$app[lifeCycle] === 'function') {
|
|
659
|
+
this.$app[lifeCycle](options);
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
this.$app.trigger(evtName, options);
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
launchApp(options) {
|
|
666
|
+
this.$app = new this.__AppClazz();
|
|
667
|
+
this.$app.$falcon = this;
|
|
668
|
+
this.$app.$meta = this.__AppClazz.meta;
|
|
669
|
+
this.$app.$meta = Object.assign(this.$app.$meta, this.$_appInfo);
|
|
670
|
+
delete this.$_appInfo;
|
|
671
|
+
delete this.__AppClazz.meta;
|
|
672
|
+
this._performAppLifeCycle('onLaunch', options || {}, 'launch');
|
|
673
|
+
return {
|
|
674
|
+
viewPort: this.$app.viewPort || 0
|
|
675
|
+
};
|
|
676
|
+
}
|
|
677
|
+
showApp() {
|
|
678
|
+
this._performAppLifeCycle('onShow', null, 'show');
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
hideApp() {
|
|
682
|
+
this._performAppLifeCycle('onHide', null, 'hide');
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
destroyApp() {
|
|
686
|
+
this._performAppLifeCycle('onDestroy', null, 'destroy');
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
onAppError(err) {
|
|
690
|
+
console.error('[Error]:', err.message, err.stack);
|
|
691
|
+
this._performAppLifeCycle('onError', err, 'error');
|
|
692
|
+
}
|
|
693
|
+
/* == app LifeCycle end ====== */
|
|
694
|
+
|
|
695
|
+
_vueErrorHandler(err, vm, info) {
|
|
696
|
+
console.error(`[Vue Error]: Error in ${info}:${err.toString()}`);
|
|
697
|
+
this.onAppError(err);
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
/* == page LifeCycle start ====== */
|
|
701
|
+
async loadPage(instanceId, pageName, options) {
|
|
702
|
+
const wxInstance = createInstance(instanceId, '', {});
|
|
703
|
+
const PageClass = await this.__loadModuleDefault(pageName);
|
|
704
|
+
try {
|
|
705
|
+
this.__loadPage(PageClass, pageName, wxInstance, instanceId, wxInstance.Vue, options);
|
|
706
|
+
} catch (e) {
|
|
707
|
+
this.onAppError(e);
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
__loadKeyFrames(page) {
|
|
712
|
+
if (!page.$animation) {
|
|
713
|
+
console.warn('please NOTE no $animation module');
|
|
714
|
+
} else {
|
|
715
|
+
if (page.$animation.loadKeyframes && this.__KEYFRAMES) {
|
|
716
|
+
page.$animation.loadKeyframes.apply(null, this.__KEYFRAMES);
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
__loadPage(PageClass, pageName, wxInstance, instanceId, Vue, options) {
|
|
722
|
+
const isPageClass = PageClass.prototype instanceof Page;
|
|
723
|
+
const page = isPageClass ? new PageClass() : new this.Page();
|
|
724
|
+
|
|
725
|
+
if (!isPageClass) {
|
|
726
|
+
page._component = PageClass;
|
|
727
|
+
page._component_only = true;
|
|
728
|
+
}
|
|
729
|
+
page._instance = wxInstance;
|
|
730
|
+
this._pageMap.set(instanceId, page);
|
|
731
|
+
|
|
732
|
+
page.$pageName = pageName;
|
|
733
|
+
page.$pageId = instanceId;
|
|
734
|
+
page.$app = this.$app;
|
|
735
|
+
page.$falcon = this;
|
|
736
|
+
|
|
737
|
+
Vue.cid = instanceId;
|
|
738
|
+
Vue.use(falconPluginFactory(this, this.$app, page, wxInstance, instanceId));
|
|
739
|
+
|
|
740
|
+
Vue.config.errorHandler = (err, vm, info) => { this._vueErrorHandler(err, vm, info); };
|
|
741
|
+
|
|
742
|
+
this._performPageLifeCycle(instanceId, 'onLoad', options, 'load');
|
|
743
|
+
|
|
744
|
+
this._performPageLifeCycle(instanceId, 'beforeVueInstantiate', Vue, 'beforeVueInstantiate');
|
|
745
|
+
|
|
746
|
+
if (this.env.platform !== 'Web') {
|
|
747
|
+
const pageModules = wxInstance.getRegisteredModules();
|
|
748
|
+
for (const mod in pageModules) {
|
|
749
|
+
const modName = `$${mod}`;
|
|
750
|
+
if (page[modName]) {
|
|
751
|
+
console.warn(`module conflict:${modName}`);
|
|
752
|
+
} else {
|
|
753
|
+
page[modName] = wxInstance.requireModule(mod);
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
this.__loadKeyFrames(page);
|
|
757
|
+
} else {
|
|
758
|
+
if (this._apply_page_mode) {
|
|
759
|
+
this._apply_page_mode(page, wxInstance);
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
page.$root = new Vue(page._component);
|
|
764
|
+
page.$root.$_page = page;
|
|
765
|
+
|
|
766
|
+
page.$root.$mount('#root');
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
_performPageLifeCycle(instanceId, lifeCycle, options, evtName) {
|
|
770
|
+
const page = this._pageMap.get(instanceId);
|
|
771
|
+
if (page) {
|
|
772
|
+
if (typeof page[lifeCycle] === 'function') {
|
|
773
|
+
page[lifeCycle](options);
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
page.trigger(evtName, options);
|
|
777
|
+
|
|
778
|
+
const pageLifeCycleOptions = {
|
|
779
|
+
page: page,
|
|
780
|
+
lifeCycle: evtName
|
|
781
|
+
};
|
|
782
|
+
this._performAppLifeCycle('onPageLifeCycle', pageLifeCycleOptions, 'pageLifeCycle');
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
showPage(instanceId) {
|
|
786
|
+
this._performPageLifeCycle(instanceId, 'onShow', null, 'show');
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
newPageOptions(instanceId, options) {
|
|
790
|
+
this._performPageLifeCycle(instanceId, 'onNewOptions', options, 'newOptions');
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
hidePage(instanceId) {
|
|
794
|
+
this._performPageLifeCycle(instanceId, 'onHide', null, 'hide');
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
unloadPage(instanceId) {
|
|
798
|
+
this._performPageLifeCycle(instanceId, 'onUnload', null, 'unload');
|
|
799
|
+
this._pageMap.delete(instanceId);
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
/* == page LifeCycle end ====== */
|
|
803
|
+
|
|
804
|
+
/* page dom start */
|
|
805
|
+
|
|
806
|
+
getPage(component) {
|
|
807
|
+
return component.$page;
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
/* page dom end */
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
/**
|
|
814
|
+
* preview for web test
|
|
815
|
+
*/
|
|
816
|
+
|
|
817
|
+
const global = window;
|
|
818
|
+
|
|
819
|
+
global['$_Falcon'] = Falcon;
|
|
820
|
+
|
|
821
|
+
// fake env
|
|
822
|
+
var __falconProfile = global.__FALCON_PROFILE__ || null;
|
|
823
|
+
var __falconLogical = (__falconProfile && __falconProfile.logical) || null;
|
|
824
|
+
|
|
825
|
+
global.WXEnvironment = {
|
|
826
|
+
'platform': 'Web',
|
|
827
|
+
'containerName': '',
|
|
828
|
+
'containerVersion': '1.0.0',
|
|
829
|
+
'osName': 'AliOSThings',
|
|
830
|
+
'osVersion': '0.0.1',
|
|
831
|
+
'deviceModel': (__falconProfile && __falconProfile.name) || 'AliOSThings',
|
|
832
|
+
'deviceWidth': (__falconLogical && __falconLogical.width) || window.innerWidth,
|
|
833
|
+
'deviceHeight': (__falconLogical && __falconLogical.height) || window.innerHeight
|
|
834
|
+
};
|
|
835
|
+
|
|
836
|
+
Falcon.initAppContext({}, global);
|
|
837
|
+
|
|
838
|
+
global.$falcon = Object.assign($falcon, driver);
|
|
839
|
+
|
|
840
|
+
function getPageName() {
|
|
841
|
+
const search = window.location.hash;
|
|
842
|
+
const query = search.split('#')[1];
|
|
843
|
+
const pageName = query ? $falcon.util.parseQuery(query).page : null;
|
|
844
|
+
return pageName || 'index'; // $falcon.app.meta.pages[0].name;
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
function registerHashChanged() {
|
|
848
|
+
window.onhashchange = () => {
|
|
849
|
+
$falcon.navTo(getPageName());
|
|
850
|
+
};
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
function _boot(App, appJson) {
|
|
854
|
+
App.meta = appJson;
|
|
855
|
+
$falcon.__AppClazz = App;
|
|
856
|
+
$falcon.launchApp();
|
|
857
|
+
$falcon.showApp();
|
|
858
|
+
|
|
859
|
+
$falcon.navTo(getPageName());
|
|
860
|
+
registerHashChanged();
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
$falcon._web_boot_app = _boot;
|