Skip to content

Instantly share code, notes, and snippets.

@jfoshee
Created June 7, 2022 23:44
Show Gist options
  • Save jfoshee/7cf10ab16d519f33c1911dedc5496de4 to your computer and use it in GitHub Desktop.
Save jfoshee/7cf10ab16d519f33c1911dedc5496de4 to your computer and use it in GitHub Desktop.
function toPromise(dbRequest: IDBRequest<any>): Promise<any> {
return new Promise((resolve, reject) => {
dbRequest.onsuccess = () => resolve(dbRequest.result);
dbRequest.onerror = () => reject();
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment