MCPcopy
hub / github.com/vueuse/vue-demi / createApp

Function createApp

lib/index.iife.js:32–69  ·  view source on GitHub ↗
(rootComponent, rootProps)

Source from the content-addressed store, hash-verified

30 return !!VueDemi.getCurrentInstance()
31 }
32 function createApp(rootComponent, rootProps) {
33 var vm
34 var provide = {}
35 var app = {
36 config: Vue.config,
37 use: Vue.use.bind(Vue),
38 mixin: Vue.mixin.bind(Vue),
39 component: Vue.component.bind(Vue),
40 provide: function (key, value) {
41 provide[key] = value
42 return this
43 },
44 directive: function (name, dir) {
45 if (dir) {
46 Vue.directive(name, dir)
47 return app
48 } else {
49 return Vue.directive(name)
50 }
51 },
52 mount: function (el, hydrating) {
53 if (!vm) {
54 vm = new Vue(Object.assign({ propsData: rootProps }, rootComponent, { provide: Object.assign(provide, rootComponent.provide) }))
55 vm.$mount(el, hydrating)
56 return vm
57 } else {
58 return vm
59 }
60 },
61 unmount: function () {
62 if (vm) {
63 vm.$destroy()
64 vm = undefined
65 }
66 },
67 }
68 return app
69 }
70 VueDemi.createApp = createApp
71 }
72 // Vue 2.6.x

Callers 1

main.jsFile · 0.50

Calls 1

directiveMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…