uni.js 562 字节
Newer Older
fxy060608's avatar
fxy060608 已提交
1 2
import './polyfill'

fxy060608's avatar
fxy060608 已提交
3
import apis from 'uni-helpers/apis'
fxy060608's avatar
fxy060608 已提交
4

fxy060608's avatar
fxy060608 已提交
5 6 7 8
import {
  wrapper,
  wrapperUnimplemented
} from 'uni-helpers/api'
fxy060608's avatar
fxy060608 已提交
9

fxy060608's avatar
fxy060608 已提交
10 11 12 13
import {
  promisify
} from 'uni-helpers/promise'

fxy060608's avatar
fxy060608 已提交
14
import baseApi from 'uni-core/service/api'
fxy060608's avatar
fxy060608 已提交
15
import platformApi from 'uni-platform/service/api'
fxy060608's avatar
fxy060608 已提交
16

fxy060608's avatar
fxy060608 已提交
17
const api = Object.assign(Object.create(null), baseApi, platformApi)
fxy060608's avatar
fxy060608 已提交
18

fxy060608's avatar
fxy060608 已提交
19
const uni = Object.create(null)
fxy060608's avatar
fxy060608 已提交
20 21 22 23 24 25 26 27

apis.forEach(name => {
  if (api[name]) {
    uni[name] = promisify(name, wrapper(name, api[name]))
  } else {
    uni[name] = wrapperUnimplemented(name)
  }
})