Skip to content

Store

Object store

  • access to all objects
  • manage index for objects

Constructors

new Store()

new Store(instantiator, options?): Store

Constructor

Parameters

instantiator: Instantiator

options?: StoreOptions

Returns

Store

Source

core/store.ts:46

Properties

history

history: Transform

History

Source

core/store.ts:31


idIndex

idIndex: Record<string, Obj>

Index for object.id

Source

core/store.ts:36


instantiator

instantiator: Instantiator

Shape instantiator

Source

core/store.ts:26


options

options: StoreOptions

Store options

Source

core/store.ts:21


root

root: null | Obj

the root object

Source

core/store.ts:41

Methods

addToIndex()

addToIndex(obj): void

Add to index for the object (with all descendants)

Parameters

obj: Obj

Returns

void

Source

core/store.ts:65


clear()

clear(): void

Clear the store

Returns

void

Source

core/store.ts:57


fromJSON()

fromJSON(json): void

Set the root from JSON

Parameters

json: any

Returns

void

Source

core/store.ts:124


getById()

getById(id): null | Obj

Get an object by id

Parameters

id: string

Returns

null | Obj

Source

core/store.ts:102


has()

has(obj): boolean

Test shape is exists in the store or not

Parameters

obj: Obj

Returns

boolean

Source

core/store.ts:109


removeFromIndex()

removeFromIndex(obj): void

Remove from index for the object (with all descendants)

Parameters

obj: Obj

Returns

void

Source

core/store.ts:79


setRoot()

setRoot(doc): void

Set the root object

Parameters

doc: Obj

Returns

void

Source

core/store.ts:137


toJSON()

toJSON(): any

Return JSON of the root

Returns

any

Source

core/store.ts:117


update()

update(obj): void

Update obj

Parameters

obj: Obj

Returns

void

Source

core/store.ts:93