quarrant / mobx-persist-store

Persist and rehydrate observable properties in mobx store.
270 stars 14 forks source link

mobx-persist-store stable release #36

Closed quarrant closed 3 years ago

quarrant commented 3 years ago

Supports only mobx v6

API

New

quarrant commented 3 years ago

@codeBelt FYI

codeBelt commented 3 years ago

@quarrant is this a todo list for a v1.0.0 release?

quarrant commented 3 years ago

@codeBelt yep

codeBelt commented 3 years ago

@quarrant can you write more information on what these are:

quarrant commented 3 years ago

@codeBelt

codeBelt commented 3 years ago

@quarrant Here is what I have so far. I had a little help from a friend on naming.

With Required Options:

import { makePersistable } from 'mobx-persist-store';

makePersistable(this, { name: 'myStore', properties: ['someProperty'], storage: window.localStorage });

With All Options:

import { configure } from 'mobx-persist-store';
import localForage from "localforage";
import ms from 'milliseconds';

makePersistable(
  this,
  {
    name: 'myStore',
    properties: ['someProperty'],
    storage: localForage,
    expireIn: ms.days(7),
    removeOnExpiration: false,
    stringify: false,
  },
  { delay: 200 }, // Optional
);

API

Configuration

import { configure } from 'mobx-persist-store';
import localForage from "localforage";
import ms from 'milliseconds';

configure({
  storage: localForage, // localForage, window.localStorage, AsyncStorage all have the same interface
  expireIn: ms.days(7),
  removeOnExpiration: false,
  stringify: false,
  delay: 200,
});

...

// Only `name` and `properties` are needed for `makePersistable`
makePersistable(this, { name: 'myStore', properties: ['someProperty'] });

I would like to write tests for PersistStore.ts still before I hand it off to you. I hope to get that done next weekend.

quarrant commented 3 years ago

@codeBelt can we talk in telegram?

https://t.me/quarrant

codeBelt commented 3 years ago

@quarrant I sent you a LinkedIn request. Lets talk there

codeBelt commented 3 years ago

@quarrant I think I am finished with all my code changes and update the README. https://github.com/codeBelt/mobx-persist-store/tree/MobxStorePersist#readme

The only thing I will need to do is update the example demo.

codeBelt commented 3 years ago

@quarrant Do want to merge my code and get a Release Candidate 1.0.0-rc.0 tag out there? Then I can start woking on the example demo and have people start playing with it.

quarrant commented 3 years ago

@quarrant Do want to merge my code and get a Release Candidate 1.0.0-rc.0 tag out there? Then I can start woking on the example demo and have people start playing with it.

done

codeBelt commented 3 years ago

@quarrant what do you think of new code: https://codesandbox.io/s/mobx-persist-store-version-1-f852w?file=/src/stores/User.store.ts&theme=dark

Do you have anyone else to give us feedback on the new changes?

codeBelt commented 3 years ago

@quarrant Have you tried out 1.0.0-rc.0? Is it ready to be released as 1.0?

quarrant commented 3 years ago

@codeBelt yep! It's a great work! let's go =)

codeBelt commented 3 years ago

@quarrant I think you can close those 4 current issues since we have a 1.0 release.