mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-23 04:51:49 +08:00
refactor(store): move datacenter into global (#1118)
This commit is contained in:
@@ -15,6 +15,7 @@ import { createBlocksuiteWorkspace } from './utils';
|
||||
import { WorkspaceUnit } from './workspace-unit';
|
||||
import type { WorkspaceUnitCollectionChangeEvent } from './workspace-unit-collection';
|
||||
import { WorkspaceUnitCollection } from './workspace-unit-collection';
|
||||
|
||||
/**
|
||||
* @class DataCenter
|
||||
* @classdesc Data center is made for managing different providers for business
|
||||
@@ -36,6 +37,10 @@ export class DataCenter {
|
||||
this._logger.enabled = debug;
|
||||
}
|
||||
|
||||
static initEmpty() {
|
||||
return new DataCenter(false);
|
||||
}
|
||||
|
||||
static async init(
|
||||
debug: boolean,
|
||||
exclude: 'affine'[] = []
|
||||
|
||||
@@ -6,17 +6,6 @@ const _initializeDataCenter = () => {
|
||||
return (debug = true) => {
|
||||
if (!_dataCenterInstance) {
|
||||
_dataCenterInstance = DataCenter.init(debug);
|
||||
_dataCenterInstance.then(dc => {
|
||||
try {
|
||||
if (window) {
|
||||
(window as any).dc = dc;
|
||||
}
|
||||
} catch (_) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
return dc;
|
||||
});
|
||||
}
|
||||
|
||||
return _dataCenterInstance;
|
||||
|
||||
Reference in New Issue
Block a user