MCPcopy Index your code
hub / github.com/TruthHun/BookStack / defineReactive$$1

Function defineReactive$$1

static/vuejs/vue.runtime.esm.js:812–865  ·  view source on GitHub ↗

* Define a reactive property on an Object.

(
  obj,
  key,
  val,
  customSetter
)

Source from the content-addressed store, hash-verified

810 * Define a reactive property on an Object.
811 */
812function defineReactive$$1 (
813 obj,
814 key,
815 val,
816 customSetter
817) {
818 var dep = new Dep();
819
820 var property = Object.getOwnPropertyDescriptor(obj, key);
821 if (property && property.configurable === false) {
822 return
823 }
824
825 // cater for pre-defined getter/setters
826 var getter = property && property.get;
827 var setter = property && property.set;
828
829 var childOb = observe(val);
830 Object.defineProperty(obj, key, {
831 enumerable: true,
832 configurable: true,
833 get: function reactiveGetter () {
834 var value = getter ? getter.call(obj) : val;
835 if (Dep.target) {
836 dep.depend();
837 if (childOb) {
838 childOb.dep.depend();
839 }
840 if (Array.isArray(value)) {
841 dependArray(value);
842 }
843 }
844 return value
845 },
846 set: function reactiveSetter (newVal) {
847 var value = getter ? getter.call(obj) : val;
848 /* eslint-disable no-self-compare */
849 if (newVal === value || (newVal !== newVal && value !== value)) {
850 return
851 }
852 /* eslint-enable no-self-compare */
853 if (process.env.NODE_ENV !== 'production' && customSetter) {
854 customSetter();
855 }
856 if (setter) {
857 setter.call(obj, newVal);
858 } else {
859 val = newVal;
860 }
861 childOb = observe(newVal);
862 dep.notify();
863 }
864 });
865}
866
867/**
868 * Set a property on an object. Adds the new property and

Callers 3

vue.runtime.esm.jsFile · 0.70
setFunction · 0.70
loopFunction · 0.70

Calls 2

observeFunction · 0.70
dependArrayFunction · 0.70

Tested by

no test coverage detected