Skip to main content

Local

Local provides a convenient way to store documents (especially JointJS graphs and cells) to client-side HTML 5 localStorage.

Learn more about the Local plugin.

Methods

insert()

storage.Local.insert(
collection: string,
doc: any,
callback: (err: Error, doc: any) => void
) => void;

Insert a document doc into the collection. Optionally pass a callback(err, doc). If the document doc didn't have an id property, one is automatically created and will be part of the doc object returned in the callback.

find()

storage.Local.find(
collection: string,
query: any,
callback: (err: Error, docs: Array<any>) => void
) => void;

Find a document in collection. query can currently be either empty, in which case all the documents from the collection are returned, or it can contain the id of a document in which case only a document with that id is returned. The callback signature is: callback(err, docs).

remove()

storage.Local.remove(
collection: string,
query: any,
callback: (err: Error) => void
) => void;

Remove a document from the collection. query can currently be either empty, in which case all the documents from the collection are removed, or it can contain an id of the document to be removed. The callback signature is: callback(err).

Types

Local

const Local: {
prefix: string;
insert: (collection: string, doc: any, callback: (err: Error, doc: any) => void) => void;
find: (collection: string, query: any, callback: (err: Error, docs: Array<any>) => void) => void;
remove: (collection: string, query: any, callback: (err: Error) => void) => void;
}

Stay in the know

Be where thousands of diagramming enthusiasts meet

Star us on GitHub