-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
29 lines (25 loc) · 814 Bytes
/
main.js
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
// import the original weex-html5.
import weex from 'weex-html5'
import hello from 'weex-hello'
// install the component.
weex.install(hello)
// init the weex and load the bundle of 'demo/index.we'.
; (function () {
function getUrlParam (key) {
const reg = new RegExp('[?|&]' + key + '=([^&]+)')
const match = location.search.match(reg)
return match && match[1]
}
const loader = getUrlParam('loader') || 'xhr'
const page = getUrlParam('page') || 'demo/build/index.js'
// jsonp callback name should be specified or be the default
// value 'weexJsonpCallback' if the 'jsonp' loader is used.
const JSONP_CALLBACK_NAME = 'weexJsonpCallback'
weex.init({
jsonpCallback: JSONP_CALLBACK_NAME,
appId: location.href,
loader: loader,
source: page,
rootId: 'weex'
})
})()