Commit
# Why I wanted to clear the way for #8242 to be landed (or not). I noticed that web support doesn't look like it should work and that it isn't tested anywhere. # How - added SQLite test suite to set run on web - changed the way we fetch values in test suite from using `._array[0]` to `.item(0)` - added explanations in `SQLite.types.ts` about why we may need a copy of `@types/websql` - added `Window` declaration to types declarations - removed `@types/websql` dependency as it's not even importable - fixed web counterpart — `SQLite.web.ts` — by fixing the method header and gracefully handling situation where `openDatabase` is not available (I think). # Test Plan Test suite passes.
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,17 @@ | ||
export const { openDatabase } = global; | ||
export default { openDatabase }; | ||
import { UnavailabilityError } from '@unimodules/core'; | ||
|
||
import { Window, DatabaseCallback } from './SQLite.types'; | ||
|
||
export function openDatabase( | ||
name: string, | ||
version: string = '1.0', | ||
description: string = name, | ||
size: number = 1, | ||
callback?: DatabaseCallback | ||
) { | ||
const typedWindow: Window = window as Window; | ||
if ('openDatabase' in typedWindow && typedWindow.openDatabase) { | ||
return typedWindow.openDatabase(name, version, description, size, callback); | ||
} | ||
throw new UnavailabilityError('window', 'openDatabase'); | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1 @@ | ||
declare const process: { | ||
env: { | ||
NODE_ENV: string; | ||
}; | ||
[key: string]: any; | ||
}; | ||
declare const process: Record<string, any>; |