Created
May 9, 2016 03:45
-
-
Save amrishodiq/cffcd03a48c5bf9b10edec5d406b2fd4 to your computer and use it in GitHub Desktop.
Lazy Load Singleton JavaScript Database
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var db = null; | |
| function getDatabase() { | |
| if (db == null) { | |
| db = openDatabase('smartCitizen', '1.0', 'Smart Citizen', 2 * 1024 * 1024); | |
| } | |
| return db; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment