MCPcopy Create free account
hub / github.com/TruthHun/BookStack / lifecycleMixin

Function lifecycleMixin

static/vuejs/vue.runtime.esm.js:2014–2101  ·  view source on GitHub ↗
(Vue)

Source from the content-addressed store, hash-verified

2012}
2013
2014function lifecycleMixin (Vue) {
2015 Vue.prototype._update = function (vnode, hydrating) {
2016 var vm = this;
2017 if (vm._isMounted) {
2018 callHook(vm, 'beforeUpdate');
2019 }
2020 var prevEl = vm.$el;
2021 var prevVnode = vm._vnode;
2022 var prevActiveInstance = activeInstance;
2023 activeInstance = vm;
2024 vm._vnode = vnode;
2025 // Vue.prototype.__patch__ is injected in entry points
2026 // based on the rendering backend used.
2027 if (!prevVnode) {
2028 // initial render
2029 vm.$el = vm.__patch__(
2030 vm.$el, vnode, hydrating, false /* removeOnly */,
2031 vm.$options._parentElm,
2032 vm.$options._refElm
2033 );
2034 } else {
2035 // updates
2036 vm.$el = vm.__patch__(prevVnode, vnode);
2037 }
2038 activeInstance = prevActiveInstance;
2039 // update __vue__ reference
2040 if (prevEl) {
2041 prevEl.__vue__ = null;
2042 }
2043 if (vm.$el) {
2044 vm.$el.__vue__ = vm;
2045 }
2046 // if parent is an HOC, update its $el as well
2047 if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
2048 vm.$parent.$el = vm.$el;
2049 }
2050 // updated hook is called by the scheduler to ensure that children are
2051 // updated in a parent's updated hook.
2052 };
2053
2054 Vue.prototype.$forceUpdate = function () {
2055 var vm = this;
2056 if (vm._watcher) {
2057 vm._watcher.update();
2058 }
2059 };
2060
2061 Vue.prototype.$destroy = function () {
2062 var vm = this;
2063 if (vm._isBeingDestroyed) {
2064 return
2065 }
2066 callHook(vm, 'beforeDestroy');
2067 vm._isBeingDestroyed = true;
2068 // remove self from parent
2069 var parent = vm.$parent;
2070 if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
2071 remove(parent.$children, vm);

Callers 1

vue.runtime.esm.jsFile · 0.70

Calls 2

callHookFunction · 0.70
removeFunction · 0.70

Tested by

no test coverage detected