agile-ts / agile

🌌 Global State and Logic Library for JavaScript/Typescript applications

Home Page:https://agile-ts.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add migration and save callbacks to persist method

bennoinbeta opened this issue Β· comments

commented

πŸ†• Feature Request

❓ Is your feature request related to a problem?

No

πŸ“„ Describe the solution you'd like

const MY_STATE = createState({name: 'jeff', created: new Date()})
MY_STATE.persist('dummyKey', {
    onMigrate: (value) => ({name: value.name, created: new Date(value.created)}),
    onSave: (value) => ({name: value.name, created: value.created.getDate()})
})