@blocksuite/store
Advanced tools
Comparing version
@@ -29,3 +29,12 @@ import type { Space } from './space.js'; | ||
} | ||
export interface StoreOptions { | ||
/** | ||
* @example | ||
* const workspace = new Workspace({ | ||
* isSSR: typeof window === 'undefined' | ||
* }) | ||
*/ | ||
export interface SSROptions { | ||
isSSR?: boolean; | ||
} | ||
export interface StoreOptions extends SSROptions { | ||
room?: string; | ||
@@ -32,0 +41,0 @@ providers?: DocProviderConstructor[]; |
@@ -167,3 +167,9 @@ import * as Y from 'yjs'; | ||
this._indexer = new Indexer(this.doc); | ||
this._blobStorage = getBlobStorage(options.room); | ||
if (!options.isSSR) { | ||
this._blobStorage = getBlobStorage(options.room); | ||
} | ||
else { | ||
// blob storage is not reachable in server side | ||
this._blobStorage = Promise.resolve(null); | ||
} | ||
this.meta = new WorkspaceMeta('space:meta', this, this._store.awareness); | ||
@@ -170,0 +176,0 @@ this.signals = { |
{ | ||
"name": "@blocksuite/store", | ||
"version": "0.3.0-20221224080508-0a1331a", | ||
"version": "0.3.0-20221224221526-1860305", | ||
"description": "BlockSuite data store built for general purpose state management.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -38,3 +38,13 @@ import type { Space } from './space.js'; | ||
export interface StoreOptions { | ||
/** | ||
* @example | ||
* const workspace = new Workspace({ | ||
* isSSR: typeof window === 'undefined' | ||
* }) | ||
*/ | ||
export interface SSROptions { | ||
isSSR?: boolean; | ||
} | ||
export interface StoreOptions extends SSROptions { | ||
room?: string; | ||
@@ -41,0 +51,0 @@ providers?: DocProviderConstructor[]; |
@@ -228,3 +228,8 @@ import * as Y from 'yjs'; | ||
this._indexer = new Indexer(this.doc); | ||
this._blobStorage = getBlobStorage(options.room); | ||
if (!options.isSSR) { | ||
this._blobStorage = getBlobStorage(options.room); | ||
} else { | ||
// blob storage is not reachable in server side | ||
this._blobStorage = Promise.resolve(null); | ||
} | ||
@@ -231,0 +236,0 @@ this.meta = new WorkspaceMeta('space:meta', this, this._store.awareness); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
406390
0.22%6795
0.43%