BlockSuite API Documentation / @blocksuite/store / Y / YArrayEvent
Class: YArrayEvent<T> 
Event that describes the changes on a YArray
Extends 
Type parameters 
• T
Constructors 
new YArrayEvent(yarray, transaction) 
new YArrayEvent<
T>(yarray,transaction):YArrayEvent<T>
Parameters 
• yarray: Array<T>
The changed type
• transaction: Transaction
The transaction object
Returns 
YArrayEvent<T>
Overrides 
@blocksuite/store.Y.YEvent.constructor
Source 
node_modules/.pnpm/yjs@13.6.11/node_modules/yjs/dist/src/types/YArray.d.ts:11
Properties 
_changes 
_changes:
null|Object
Inherited from 
@blocksuite/store.Y.YEvent._changes
Source 
node_modules/.pnpm/yjs@13.6.11/node_modules/yjs/dist/src/utils/YEvent.d.ts:29
_delta 
_delta:
null|Object[]
Inherited from 
@blocksuite/store.Y.YEvent._delta
Source 
node_modules/.pnpm/yjs@13.6.11/node_modules/yjs/dist/src/utils/YEvent.d.ts:41
_keys 
_keys:
null|Map<string,Object>
Inherited from 
@blocksuite/store.Y.YEvent._keys
Source 
node_modules/.pnpm/yjs@13.6.11/node_modules/yjs/dist/src/utils/YEvent.d.ts:33
_path 
_path:
null| (string|number)[]
Inherited from 
@blocksuite/store.Y.YEvent._path
Source 
node_modules/.pnpm/yjs@13.6.11/node_modules/yjs/dist/src/utils/YEvent.d.ts:52
_transaction 
_transaction:
Transaction
Source 
node_modules/.pnpm/yjs@13.6.11/node_modules/yjs/dist/src/types/YArray.d.ts:12
currentTarget 
currentTarget:
AbstractType<any>
The current target on which the observe callback is called.
Inherited from 
@blocksuite/store.Y.YEvent.currentTarget
Source 
node_modules/.pnpm/yjs@13.6.11/node_modules/yjs/dist/src/utils/YEvent.d.ts:20
target 
target:
Array<T>
The type on which this event was created on.
Inherited from 
@blocksuite/store.Y.YEvent.target
Source 
node_modules/.pnpm/yjs@13.6.11/node_modules/yjs/dist/src/utils/YEvent.d.ts:15
transaction 
transaction:
Transaction
The transaction that triggered this event.
Inherited from 
@blocksuite/store.Y.YEvent.transaction
Source 
node_modules/.pnpm/yjs@13.6.11/node_modules/yjs/dist/src/utils/YEvent.d.ts:25
Accessors 
changes 
getchanges():Object
This is a computed property. Note that this can only be safely computed during the event call. Computing this property after other changes happened might result in unexpected behavior (incorrect computation of deltas). A safe way to collect changes is to store the changes or the delta object. Avoid storing the transaction object.
Returns 
Object
added 
added:
Set<Item>deleted 
deleted:
Set<Item>delta 
delta:
Object[]keys 
keys:
Map<string,Object>
Source 
node_modules/.pnpm/yjs@13.6.11/node_modules/yjs/dist/src/utils/YEvent.d.ts:117
delta 
getdelta():Object[]
This is a computed property. Note that this can only be safely computed during the event call. Computing this property after other changes happened might result in unexpected behavior (incorrect computation of deltas). A safe way to collect changes is to store the changes or the delta object. Avoid storing the transaction object.
Returns 
Object[]
Source 
node_modules/.pnpm/yjs@13.6.11/node_modules/yjs/dist/src/utils/YEvent.d.ts:92
keys 
getkeys():Map<string,Object>
Returns 
Map<string, Object>
Source 
node_modules/.pnpm/yjs@13.6.11/node_modules/yjs/dist/src/utils/YEvent.d.ts:79
path 
getpath(): (string|number)[]
Computes the path from y to the changed type.
Todo 
v14 should standardize on path: Array<{parent, index}> because that is easier to work with.
The following property holds:
Example 
let type = y
  event.path.forEach(dir => {
    type = type.get(dir)
  })
  type === event.target // => trueReturns 
(string | number)[]
Source 
node_modules/.pnpm/yjs@13.6.11/node_modules/yjs/dist/src/utils/YEvent.d.ts:66
Methods 
adds() 
adds(
struct):boolean
Check if a struct is added by this event.
In contrast to change.deleted, this method also returns true if the struct was added and then deleted.
Parameters 
• struct: AbstractStruct
Returns 
boolean
Inherited from 
@blocksuite/store.Y.YEvent.adds
Source 
node_modules/.pnpm/yjs@13.6.11/node_modules/yjs/dist/src/utils/YEvent.d.ts:108
deletes() 
deletes(
struct):boolean
Check if a struct is deleted by this event.
In contrast to change.deleted, this method also returns true if the struct was added and then deleted.
Parameters 
• struct: AbstractStruct
Returns 
boolean
Inherited from 
@blocksuite/store.Y.YEvent.deletes
Source 
node_modules/.pnpm/yjs@13.6.11/node_modules/yjs/dist/src/utils/YEvent.d.ts:75
Generated using TypeDoc and typedoc-plugin-markdown.