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

Function lifecycleMixin

static/vuejs/vue.esm.js:2018–2105  ·  view source on GitHub ↗
(Vue)

Source from the content-addressed store, hash-verified

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

Callers 1

vue.esm.jsFile · 0.70

Calls 2

callHookFunction · 0.70
removeFunction · 0.70

Tested by

no test coverage detected