MCPcopy
hub / github.com/NaiboWang/EasySpider / createArrayInstrumentations

Function createArrayInstrumentations

ElectronJS/src/js/vue.global.js:860–888  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

858 const shallowReadonlyGet = /*#__PURE__*/ createGetter(true, true);
859 const arrayInstrumentations = /*#__PURE__*/ createArrayInstrumentations();
860 function createArrayInstrumentations() {
861 const instrumentations = {};
862 ['includes', 'indexOf', 'lastIndexOf'].forEach(key => {
863 instrumentations[key] = function (...args) {
864 const arr = toRaw(this);
865 for (let i = 0, l = this.length; i < l; i++) {
866 track(arr, "get" /* TrackOpTypes.GET */, i + '');
867 }
868 // we run the method using the original args first (which may be reactive)
869 const res = arr[key](...args);
870 if (res === -1 || res === false) {
871 // if that didn't work, run it again using raw values.
872 return arr[key](...args.map(toRaw));
873 }
874 else {
875 return res;
876 }
877 };
878 });
879 ['push', 'pop', 'shift', 'unshift', 'splice'].forEach(key => {
880 instrumentations[key] = function (...args) {
881 pauseTracking();
882 const res = toRaw(this)[key].apply(this, args);
883 resetTracking();
884 return res;
885 };
886 });
887 return instrumentations;
888 }
889 function hasOwnProperty(key) {
890 const obj = toRaw(this);
891 track(obj, "has" /* TrackOpTypes.HAS */, key);

Callers 1

vue.global.jsFile · 0.85

Calls 4

toRawFunction · 0.85
trackFunction · 0.85
pauseTrackingFunction · 0.85
resetTrackingFunction · 0.85

Tested by

no test coverage detected