feat(mobx): add drafts and state context

This commit is contained in:
Paul Makles
2021-12-10 12:53:41 +00:00
parent 66bfc658c3
commit 5a41c25e3c
10 changed files with 285 additions and 14 deletions

16
src/mobx/Persistent.ts Normal file
View File

@@ -0,0 +1,16 @@
/**
* A data store which is persistent and should cache its data locally.
*/
export default interface Persistent<T> {
/**
* Override toJSON to serialise this data store.
* This will also force all subclasses to implement this method.
*/
toJSON(): unknown;
/**
* Hydrate this data store using given data.
* @param data Given data
*/
hydrate(data: T): void;
}