MCPcopy
hub / github.com/vuejs/core / createReadonlyMethod

Function createReadonlyMethod

packages/reactivity/src/collectionHandlers.ts:77–92  ·  view source on GitHub ↗
(type: TriggerOpTypes)

Source from the content-addressed store, hash-verified

75}
76
77function createReadonlyMethod(type: TriggerOpTypes): Function {
78 return function (this: CollectionTypes, ...args: unknown[]) {
79 if (__DEV__) {
80 const key = args[0] ? `on key "${args[0]}" ` : ``
81 warn(
82 `${capitalize(type)} operation ${key}failed: target is readonly.`,
83 toRaw(this),
84 )
85 }
86 return type === TriggerOpTypes.DELETE
87 ? false
88 : type === TriggerOpTypes.CLEAR
89 ? undefined
90 : this
91 }
92}
93
94type Instrumentations = Record<string | symbol, Function | number>
95

Callers 1

createInstrumentationsFunction · 0.85

Calls 2

warnFunction · 0.90
toRawFunction · 0.90

Tested by

no test coverage detected