You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Saúl Ibarra Corretgé 7ea2b9c8c0 fix(misc) use safeJsonParse from js-utils 1 年之前
..
MiddlewareRegistry.ts ref(TS) Require interfaces to start with I (#12424) 2 年之前
PersistenceRegistry.ts fix(misc) use safeJsonParse from js-utils 1 年之前
README.md redux: move PersistenceRegistry to the redux feature 5 年之前
ReducerRegistry.ts ref(eslint) Use new TypeScript ESlint config (#12143) 2 年之前
StateListenerRegistry.ts feat(redux) throw exception in case invalid listeners are registered 2 年之前
functions.ts ref(TS) Improve TS (#13167) 2 年之前
logger.ts ref: Improve TS files (#12130) 2 年之前
middleware.ts feat(base/redux): fixed local storage on native 2 年之前

README.md

Jitsi Meet - redux state persistence

Jitsi Meet has a persistence layer that persists specific subtrees of the redux store/state into window.localStorage (on Web) or AsyncStorage (on mobile).

Usage

If a subtree of the redux store should be persisted (e.g. 'features/base/settings'), then persistence for that subtree should be requested by registering the subtree with PersistenceRegistry.

For example, to register the field displayName of the redux subtree 'features/base/settings' to be persisted, use:

PersistenceRegistry.register('features/base/settings', {
    displayName: true
});

in the reducer.js of the base/settings feature.

If the second parameter is omitted, the entire feature state is persisted.

When it’s done, Jitsi Meet will automatically persist these subtrees and rehydrate them on startup.

Throttling

To avoid too frequent write operations in the storage, we utilize throttling in the persistence layer, meaning that the storage gets persisted only once every 2 seconds, even if multiple redux state changes occur during this period. The throttling timeout can be configured in

react/features/base/storage/middleware.js#PERSIST_STATE_DELAY

Serialization

The API JSON.stringify() is currently used to serialize feature states, therefore its limitations affect the persistency feature too. E.g. complex objects, such as Maps (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) or Sets (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) cannot be automatically persisted at the moment. The same applies to Functions (which is not a good practice to store in Redux anyhow).