Skip to content

Polyfill for browsers lacking WebSQL implementation (i.e. Firefox & IE)

Notifications You must be signed in to change notification settings

Philzen/WebSQL-Polyfill

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WebSQL-Polyfill

Polyfill for browsers lacking WebSQL implementation (i.e. Firefox & IE)

Purpose

Simply put, imagine an application at hand that uses web sql storage methods, such as those found in the Cordova Storage API. This Polyfill helps with making it run- and testable on Firefox and IE.

Usage

Clone the project recursively in order to get the depending sql.js code:

git clone --recursive [email protected]:Philzen/WebSQL-Polyfill.git {target_folder}  

Then, simply include the script in your html:

<script src="{target_folder}/websql-polyfill.js" type="text/javascript" ></script>  

WebSQL-Polyfill lazy-loads the dependency script into the DOM on-demand given that:

a. window.openDatabase is not defined
b. you are actually calling window.openDatabase at least once

Otherwise, nothing will be loaded, executed and polyfilled, as there is no need for it in those cases.

Current known limitations

  • Datastore is not persisted during requests
  • Though asynchronous websql API is adapted, currently everything executes in a synchronous manner

ToDos / Roadmap

  • use exportData()-method of sql.js to persist data after each transaction
  • add option to select localStorage vs. IndexedDb for persistence, when both are available (where indexedDb persistence should restore asynchronous behaviour)

Acknowledgements

This project currently uses sql.js to enable easy abstraction of an SQLite database in memory.

About

Polyfill for browsers lacking WebSQL implementation (i.e. Firefox & IE)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published