array.ts — vue Source File
Architecture documentation for array.ts, a typescript file in the vue codebase. 2 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR 62074bbb_3339_ba82_2975_f5cd0be2308e["array.ts"] f0fec710_9627_fe4c_002d_7f657fb9e5d0["index.ts"] 62074bbb_3339_ba82_2975_f5cd0be2308e --> f0fec710_9627_fe4c_002d_7f657fb9e5d0 76672dd6_4e87_4468_a48b_f4da793fd211["index.ts"] 62074bbb_3339_ba82_2975_f5cd0be2308e --> 76672dd6_4e87_4468_a48b_f4da793fd211 af395f8e_1ac5_a239_71b7_fd29a1c03d2c["index.ts"] af395f8e_1ac5_a239_71b7_fd29a1c03d2c --> 62074bbb_3339_ba82_2975_f5cd0be2308e style 62074bbb_3339_ba82_2975_f5cd0be2308e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
/*
* not type checking this file because flow doesn't play well with
* dynamically accessing methods on Array prototype
*/
import { TriggerOpTypes } from '../../v3'
import { def } from '../util/index'
const arrayProto = Array.prototype
export const arrayMethods = Object.create(arrayProto)
const methodsToPatch = [
'push',
'pop',
'shift',
'unshift',
'splice',
'sort',
'reverse'
]
/**
* Intercept mutating methods and emit events
*/
methodsToPatch.forEach(function (method) {
// cache original method
const original = arrayProto[method]
def(arrayMethods, method, function mutator(...args) {
const result = original.apply(this, args)
const ob = this.__ob__
let inserted
switch (method) {
case 'push':
case 'unshift':
inserted = args
break
case 'splice':
inserted = args.slice(2)
break
}
if (inserted) ob.observeArray(inserted)
// notify change
if (__DEV__) {
ob.dep.notify({
type: TriggerOpTypes.ARRAY_MUTATION,
target: this,
key: method
})
} else {
ob.dep.notify()
}
return result
})
})
Domain
Imported By
Source
Frequently Asked Questions
What does array.ts do?
array.ts is a source file in the vue codebase, written in typescript. It belongs to the VueCore domain.
What does array.ts depend on?
array.ts imports 2 module(s): index.ts, index.ts.
What files import array.ts?
array.ts is imported by 1 file(s): index.ts.
Where is array.ts in the architecture?
array.ts is located at src/core/observer/array.ts (domain: VueCore, directory: src/core/observer).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free