-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
59 lines (50 loc) · 1.8 KB
/
index.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
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
//import 'babel-polyfill'
// import 'url-polyfill'
import { config, start, componentFactory } from 'edf-meta-engine'
import * as edfComponents from 'edf-component'
import raf from 'raf'
import myConfig from './config'
//import registerServiceWorker from './registerServiceWorker'
// import promise from 'es6-promise'
raf.polyfill()
if (typeof (_hmt) == 'undefined') window._hmt = []
if (typeof (_maq) == 'undefined') window._maq = []
import './global/global.js'
//note-start
//note-start和note-end之间的内容用脚手架匹配,请不要再该区域书写内容,在执行ttk delmodule过程中会被删除
import useEDF from 'useEDF'
import originalStyle from 'originalStyle'
const arr = [useEDF, originalStyle]
Promise.all(arr).then((res) => {
let apps = {}
//console.log('index.js', res)
res.forEach((item) => {
apps = { ...apps, ...item }
})
if (window.singleApp) {
const singleApp = window.singleApp
apps = { ...apps, ...singleApp }
}
//note-end
apps.config = (options) => {
Object.keys(options).forEach(key => {
const reg = new RegExp(`^${key == '*' ? '.*' : key}$`)
Object.keys(apps).forEach(appName => {
if (appName != 'config') {
if (reg.test(appName) && apps[appName].config) {
apps[appName].config(options[key])
}
}
})
})
}
// promise.polyfill()
apps.config({ '*': { apps } })
config(myConfig({ apps }))
Object.keys(edfComponents).forEach(key => {
componentFactory.registerComponent(key, edfComponents[key])
})
start()
})
//service worker是在后台运行的一个线程,可以用来处理离线缓存、消息推送、后台自动更新等任务
//registerServiceWorker()