-
Notifications
You must be signed in to change notification settings - Fork 6
Implements project saving and loading in Play #35
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
Conversation
? html` | ||
<div> | ||
<select id="project-select" size="8"> | ||
${this._projects.map( |
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.
I'm curious what might be a good sort order to show these in. Last updated?
return new Promise((resolve, reject) => { | ||
const request = store.add(project) | ||
request.onsuccess = () => { | ||
resolve(project) | ||
} | ||
request.onerror = () => { | ||
reject(request.error) | ||
} | ||
}) |
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.
I wonder if we can create a helper for that (and other similar operations)
function IDBRequestToPromise<SuccessPayload>(request: IDBRequest, successPayload: SuccessPayload) {
return new Promise((resolve, reject) => {
request.onsuccess = () => {
resolve(successPayload)
}
request.onerror = () => {
reject(request.error)
}
})
}
return IDBRequestToPromise<Project>(store.add(project), project);
Something like that. IDK if it's better or not for readability though.
💸 TL;DR
Implements Project-level saving and loading in Play.
Details
This includes:
ProjectStorageClient
interface, which can be swapped out latersessionStorage
, so that it persists across reload but not across tabs