MCPcopy
hub / github.com/GrapesJS/grapesjs / store

Method store

packages/core/src/editor/model/Editor.ts:902–917  ·  view source on GitHub ↗

* Store data to the current storage. * @public

(options?: T)

Source from the content-addressed store, hash-verified

900 * @public
901 */
902 async store<T extends StorageOptions>(options?: T) {
903 if (this._isStoring) return;
904 this._isStoring = true;
905 // We use a 1ms timeout to defer the cleanup to the next tick of the event loop.
906 // This prevents a race condition where a store operation, like 'sync:content',
907 // might increase the dirty count before it can be properly cleared.
908 setTimeout(() => {
909 this.clearDirtyCount();
910 }, 1);
911 const data = this.storeData();
912 await this.Storage.store(data, options);
913 setTimeout(() => {
914 this._isStoring = false;
915 }, 1);
916 return data;
917 }
918
919 /**
920 * Load data from the current storage.

Callers 1

updateChangesMethod · 0.95

Calls 3

clearDirtyCountMethod · 0.95
storeDataMethod · 0.95
storeMethod · 0.65

Tested by

no test coverage detected