aboutsummaryrefslogtreecommitdiff
path: root/node_modules/vue/src/core/global-api/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/vue/src/core/global-api/index.js')
-rw-r--r--node_modules/vue/src/core/global-api/index.js62
1 files changed, 62 insertions, 0 deletions
diff --git a/node_modules/vue/src/core/global-api/index.js b/node_modules/vue/src/core/global-api/index.js
new file mode 100644
index 00000000..03ffa0fb
--- /dev/null
+++ b/node_modules/vue/src/core/global-api/index.js
@@ -0,0 +1,62 @@
+/* @flow */
+
+import config from '../config'
+import { initUse } from './use'
+import { initMixin } from './mixin'
+import { initExtend } from './extend'
+import { initAssetRegisters } from './assets'
+import { set, del } from '../observer/index'
+import { ASSET_TYPES } from 'shared/constants'
+import builtInComponents from '../components/index'
+
+import {
+ warn,
+ extend,
+ nextTick,
+ mergeOptions,
+ defineReactive
+} from '../util/index'
+
+export function initGlobalAPI (Vue: GlobalAPI) {
+ // config
+ const configDef = {}
+ configDef.get = () => config
+ if (process.env.NODE_ENV !== 'production') {
+ configDef.set = () => {
+ warn(
+ 'Do not replace the Vue.config object, set individual fields instead.'
+ )
+ }
+ }
+ Object.defineProperty(Vue, 'config', configDef)
+
+ // exposed util methods.
+ // NOTE: these are not considered part of the public API - avoid relying on
+ // them unless you are aware of the risk.
+ Vue.util = {
+ warn,
+ extend,
+ mergeOptions,
+ defineReactive
+ }
+
+ Vue.set = set
+ Vue.delete = del
+ Vue.nextTick = nextTick
+
+ Vue.options = Object.create(null)
+ ASSET_TYPES.forEach(type => {
+ Vue.options[type + 's'] = Object.create(null)
+ })
+
+ // this is used to identify the "base" constructor to extend all plain-object
+ // components with in Weex's multi-instance scenarios.
+ Vue.options._base = Vue
+
+ extend(Vue.options.components, builtInComponents)
+
+ initUse(Vue)
+ initMixin(Vue)
+ initExtend(Vue)
+ initAssetRegisters(Vue)
+}