Skip to content

Instantly share code, notes, and snippets.

@jloscos
Created March 10, 2018 15:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jloscos/2e34ddb82072b12b4d71c0ed619328b9 to your computer and use it in GitHub Desktop.
Save jloscos/2e34ddb82072b12b4d71c0ed619328b9 to your computer and use it in GitHub Desktop.
function initDB(db: IDBDatabase) {
if (!db.objectStoreNames.contains("blog")) {
const store = db.createObjectStore("blog", { keyPath: "title" });
store.createIndex("AuthorIndex", "author", { unique: false });
store.createIndex("PublishDateIndex", "publishDate", { unique: false });
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment