跳到主要内容

RxDBPluginStorage

Defined in: packages/rxdb-plugin-storage/src/plugin.ts:24

把 RxdbFileStorage 安装到单个 RxDB 实例的插件生命周期对象。

Remarks​

三处宿主改动各占一条作用域条目——建服务、挂 rxdb.storage、注册 metadata 实体—— 断开连接时按逆序退回:先摘实体、再摘属性、最后等 storage 排空。改造前这三件事 分散在构造函数、install()、destroy() 里,靠 #ownsStorage / #registeredEntity 两个布尔量对账;现在清单在作用域里,插件不再自己记。

服务只在连接期间存在:storage 在安装前与拆卸后都是 undefined。

Extends​

Implements​

Constructors​

Constructor​

new RxDBPluginStorage(rxdb, options?): RxDBPluginStorage;

Defined in: packages/rxdb-plugin-storage/src/plugin.ts:38

创建 storage 插件生命周期对象。

Parameters​

ParameterType
rxdbRxDB
optionsRxDBStoragePluginOptions

Returns​

RxDBPluginStorage

Overrides​

RxDBPluginBase.constructor

Properties​

lifecycle​

readonly lifecycle: "scoped";

Defined in: packages/rxdb-plugin-storage/src/plugin.ts:28

已迁移到作用域拆卸,宿主不再调用 destroy()。

Implementation of​

IRxDBPlugin.lifecycle


name​

readonly name: "storage";

Defined in: packages/rxdb-plugin-storage/src/plugin.ts:30

RxDB 插件唯一名称。

Implementation of​

IRxDBPlugin.name


rxdb​

protected readonly rxdb: RxDB;

Defined in: packages/rxdb/dist/rxdb-plugin.d.ts:136

Inherited from​

RxDBPluginBase.rxdb

Accessors​

storage​

Get Signature​

get storage(): RxdbFileStorage | undefined;

Defined in: packages/rxdb-plugin-storage/src/plugin.ts:33

当前连接纪元的文件存储服务;安装前与拆卸后为 undefined。

Returns​

RxdbFileStorage | undefined

Methods​

install()​

install(scope): void;

Defined in: packages/rxdb-plugin-storage/src/plugin.ts:44

建服务、挂 rxdb.storage、注册 metadata 实体,三步各自登记撤销条目。

Parameters​

ParameterType
scopeLifecycleScope

Returns​

void

Implementation of​

IRxDBPlugin.install