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

Function lifecycleMixin

static/vuejs/vue.runtime.js:2020–2107  ·  view source on GitHub ↗
(Vue)

Source from the content-addressed store, hash-verified

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

Callers 1

vue.runtime.jsFile · 0.70

Calls 2

callHookFunction · 0.70
removeFunction · 0.70

Tested by

no test coverage detected