Skip to content

added event and state classes#1

Open
cat-toreda wants to merge 4 commits intodevelopfrom
feature/state
Open

added event and state classes#1
cat-toreda wants to merge 4 commits intodevelopfrom
feature/state

Conversation

@cat-toreda
Copy link

@cat-toreda cat-toreda commented Apr 28, 2022

added event and state classes and also added save and retrieve methods

@cat-toreda cat-toreda requested a review from mbrich April 28, 2022 17:00
return this.events;
}

async retrieve(key): Promise<unknown> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make retrieve a generic so that it’s called with a type:
ex: async function retrieve(…)
we will want specific type helpers which pass a type in like retrieveString which returns retrieve(…)

@@ -0,0 +1,24 @@
import {Event} from './event';

export class State {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for the state class make sure to include an optional StateData argument in the form step for which includes any preexisting state.
also make sure to include the adapter logic. the state class acts as a proxy and gets called by the user but internally passes all the calls, which are just save and retrieve for now, to the adapter. why use an adapter? we want settings and important values stored on device whenever possible and each platform handles it differently. writing adapters gives us a standardized interface to work with keys while also writing custom logic per platform.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants