-
Notifications
You must be signed in to change notification settings - Fork 0
added event and state classes #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
return this.events; | ||
} | ||
|
||
async retrieve(key): Promise<unknown> { |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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.
added event and state classes and also added save and retrieve methods