SlideShare a Scribd company logo
1 of 26
Download to read offline
WHO’S AFRAID OF
FRONT-END DATABASES?
Gil Fink
CEO and Senior Consultant, sparXys
@gilfink
Front-end Storage Problem
Cookies
Are such an old technology…
How localStorage feels like
About Me
• sparXys CEO and senior consultant
• ASP.NET/IIS Microsoft MVP in the last 7 years
• Pro Single Page Application Development (Apress)
co-author
• 4 Microsoft Official Courses (MOCs) co-author
• GDG Rashlatz and Angular UP co-organizer
Agenda
• IndexedDB
• Libraries to the rescue
Storing Data in The
Browser
• Cookies
o Super small storage, string based, API not friendly
• Web Storage (localStorage/sessionStorage)
o String based dictionary, synchronous API
• Web SQL database
o Deprecated!
localStorage
Demo
IndexedDB
• Advanced key-value data management
IndexedDB
Front-end
App
Fast
Reliable
Limited capacity
Local access only
Information loss
IndexedDB
• Made of records holding simple values or
hierarchical objects
o Each record is a key/value pair
• Enables
o Storage of large numbers of objects locally
o Fast insertion and extraction
• Satisfy some of the offline data requirements for
web applications
IndexedDB
Database
objectStore
Cursor on
objectStore
key : value
key : value
key : value
Index
Cursor on
index
IndexedDB API
• Very massive API!
• API is asynchronous
o Note: Synchronous APIs were deprecated by W3C
• Exposed through window.indexedDB object
IndexedDB – Open the
Database
var db;
var request = window.indexedDB.open(“dbName");
request.onerror = function(event) {
console.log(“Database error on open: ” + event.target.errorCode);
};
request.onsuccess = function(event) {
db = request.result;
};
IndexedDB – Creating an
objectStore
var request = indexedDB.open(‘dbName’, 2);
request.onupgradeneeded = function(event) {
// Create an objectStore to hold information about customers.
var objectStore = db.createObjectStore(“products", { keyPath: “id" });
// Create an index to search customers by name.
objectStore.createIndex("name", "name", { unique: false });
// Store value in the newly created objectStore.
objectStore.add({ id: 3, name: “db“ });
};
IndexedDB – Creating a
Transaction
var transaction = db.transaction([“products"], “readwrite”);
transaction.oncomplete = function(event) {
console.log(“Transaction completed”);
};
transaction.onerror = function(event) {
// handle transaction errors
};
// will add the object into the objectStore
var objectStore = transaction.objectStore(“products”);
var request = objectStore.add({ id: 7, name: “IndexedDB" });
request.onsuccess = function(event) {
// event.target.result == object.id
}
IndexedDB – Using a
Cursor
var transaction = db.transaction([“products”]);
var objectStore = transaction.objectStore(“products”);
var cursor = objectStore.openCursor();
cursor.onsuccess = function(event) {
var cursor = event.target.result;
if (cursor) {
console.log(“id:”+cursor.key+” has name:”+cursor.value.name);
cursor.continue();
}
else {
console.log(“No entries”);
}
};
IndexedDB – Working
with Indexes
var transaction = db.transaction([“products”]);
var objectStore = transaction.objectStore(“products”);
var index = objectStore.index(“name”);
var request = index.get(“IndexedDB");
request.onsuccess = function(event) {
console.log(“id: " + event.target.result.id);
};
IndexedDB
Demo
Problems?
• Verbose syntax
o Too much boilerplate
• No support for queries style SQL
• No full text search
• And more
Libraries to the Rescue
• PouchDB - https://pouchdb.com/
o Good wrapper on top of IndexedDB with fallbacks
• Working in Angular?
o Angular 1 service - https://github.com/bramski/angular-indexedDB
o angular2-indexeddb experimental service -
https://github.com/gilf/angular2-indexeddb
angular2-indexeddb
Demo
Summary
• IndexedDB is a full blown database in your app’s
front-end
• It can help you to persist your front-end data
• IndexedDB is suitable for offline scenarios
Resources
• IndexedDB on MDN - http://mzl.la/1u1sngQ
• angular2-indexeddb -
https://github.com/gilf/angular2-indexeddb
• My Website – http://www.gilfink.net
• Follow me on Twitter – @gilfink
Thank You!

More Related Content

What's hot

The 4 Layers of Single Page Applications You Need to Know
The 4 Layers of Single Page Applications You Need to KnowThe 4 Layers of Single Page Applications You Need to Know
The 4 Layers of Single Page Applications You Need to KnowDaniel Dughila
 
Introduction to react
Introduction to reactIntroduction to react
Introduction to reactkiranabburi
 
Angular JS Indtrodution
Angular JS IndtrodutionAngular JS Indtrodution
Angular JS Indtrodutionadesh21
 
React.js in real world apps.
React.js in real world apps. React.js in real world apps.
React.js in real world apps. Emanuele DelBono
 
Querying with Rails
Querying with RailsQuerying with Rails
Querying with RailsParth Modi
 
Managing state in asp.net
Managing state in asp.netManaging state in asp.net
Managing state in asp.netSireesh K
 
Robust UI development with ClojureScript
Robust UI development with ClojureScriptRobust UI development with ClojureScript
Robust UI development with ClojureScriptSandilya Jandhyala
 
Google App Engine Developer - Day2
Google App Engine Developer - Day2Google App Engine Developer - Day2
Google App Engine Developer - Day2Simon Su
 
Redux and context api with react native app introduction, use cases, implemen...
Redux and context api with react native app introduction, use cases, implemen...Redux and context api with react native app introduction, use cases, implemen...
Redux and context api with react native app introduction, use cases, implemen...Katy Slemon
 
From ActiveRecord to EventSourcing
From ActiveRecord to EventSourcingFrom ActiveRecord to EventSourcing
From ActiveRecord to EventSourcingEmanuele DelBono
 
Softwerkskammer Lübeck 08/2018 Event Sourcing and CQRS
Softwerkskammer Lübeck 08/2018 Event Sourcing and CQRSSoftwerkskammer Lübeck 08/2018 Event Sourcing and CQRS
Softwerkskammer Lübeck 08/2018 Event Sourcing and CQRSDaniel Bimschas
 
GraphQL, Redux, and React
GraphQL, Redux, and ReactGraphQL, Redux, and React
GraphQL, Redux, and ReactKeon Kim
 
Moving From AngularJS to Angular 2
Moving From AngularJS to  Angular 2 Moving From AngularJS to  Angular 2
Moving From AngularJS to Angular 2 Exilesoft
 

What's hot (20)

The 4 Layers of Single Page Applications You Need to Know
The 4 Layers of Single Page Applications You Need to KnowThe 4 Layers of Single Page Applications You Need to Know
The 4 Layers of Single Page Applications You Need to Know
 
logcat Hilt
logcat Hiltlogcat Hilt
logcat Hilt
 
React / Redux Architectures
React / Redux ArchitecturesReact / Redux Architectures
React / Redux Architectures
 
Introduction to react
Introduction to reactIntroduction to react
Introduction to react
 
Angular js
Angular jsAngular js
Angular js
 
Angular JS Indtrodution
Angular JS IndtrodutionAngular JS Indtrodution
Angular JS Indtrodution
 
React js
React jsReact js
React js
 
React.js in real world apps.
React.js in real world apps. React.js in real world apps.
React.js in real world apps.
 
Querying with Rails
Querying with RailsQuerying with Rails
Querying with Rails
 
Managing state in asp.net
Managing state in asp.netManaging state in asp.net
Managing state in asp.net
 
How to Redux
How to ReduxHow to Redux
How to Redux
 
React introduction
React introductionReact introduction
React introduction
 
Robust UI development with ClojureScript
Robust UI development with ClojureScriptRobust UI development with ClojureScript
Robust UI development with ClojureScript
 
Google App Engine Developer - Day2
Google App Engine Developer - Day2Google App Engine Developer - Day2
Google App Engine Developer - Day2
 
Redux and context api with react native app introduction, use cases, implemen...
Redux and context api with react native app introduction, use cases, implemen...Redux and context api with react native app introduction, use cases, implemen...
Redux and context api with react native app introduction, use cases, implemen...
 
From ActiveRecord to EventSourcing
From ActiveRecord to EventSourcingFrom ActiveRecord to EventSourcing
From ActiveRecord to EventSourcing
 
Softwerkskammer Lübeck 08/2018 Event Sourcing and CQRS
Softwerkskammer Lübeck 08/2018 Event Sourcing and CQRSSoftwerkskammer Lübeck 08/2018 Event Sourcing and CQRS
Softwerkskammer Lübeck 08/2018 Event Sourcing and CQRS
 
GraphQL, Redux, and React
GraphQL, Redux, and ReactGraphQL, Redux, and React
GraphQL, Redux, and React
 
PostGraphQL
PostGraphQLPostGraphQL
PostGraphQL
 
Moving From AngularJS to Angular 2
Moving From AngularJS to  Angular 2 Moving From AngularJS to  Angular 2
Moving From AngularJS to Angular 2
 

Similar to Who's afraid of front end databases

Whos afraid of front end databases?
Whos afraid of front end databases?Whos afraid of front end databases?
Whos afraid of front end databases?Gil Fink
 
Who's afraid of front end databases?
Who's afraid of front end databases?Who's afraid of front end databases?
Who's afraid of front end databases?Gil Fink
 
Working with Data in Service Workers
Working with Data in Service WorkersWorking with Data in Service Workers
Working with Data in Service WorkersGil Fink
 
Intro to IndexedDB (Beta)
Intro to IndexedDB (Beta)Intro to IndexedDB (Beta)
Intro to IndexedDB (Beta)Mike West
 
Taking Web Apps Offline
Taking Web Apps OfflineTaking Web Apps Offline
Taking Web Apps OfflinePedro Morais
 
ArangoDB – A different approach to NoSQL
ArangoDB – A different approach to NoSQLArangoDB – A different approach to NoSQL
ArangoDB – A different approach to NoSQLArangoDB Database
 
The Fine Art of Schema Design in MongoDB: Dos and Don'ts
The Fine Art of Schema Design in MongoDB: Dos and Don'tsThe Fine Art of Schema Design in MongoDB: Dos and Don'ts
The Fine Art of Schema Design in MongoDB: Dos and Don'tsMatias Cascallares
 
Save your data
Save your dataSave your data
Save your datafragphace
 
HTML5 Storage/Cache
HTML5 Storage/CacheHTML5 Storage/Cache
HTML5 Storage/CacheAndy Wang
 
Academy PRO: HTML5 Data storage
Academy PRO: HTML5 Data storageAcademy PRO: HTML5 Data storage
Academy PRO: HTML5 Data storageBinary Studio
 
mongodb-120401144140-phpapp01 claud camputing
mongodb-120401144140-phpapp01 claud camputingmongodb-120401144140-phpapp01 claud camputing
mongodb-120401144140-phpapp01 claud camputingmoeincanada007
 
Notes on SF W3Conf
Notes on SF W3ConfNotes on SF W3Conf
Notes on SF W3ConfEdy Dawson
 
Find your data - using GraphDB capabilities in XPages applications - ICS.UG 2016
Find your data - using GraphDB capabilities in XPages applications - ICS.UG 2016Find your data - using GraphDB capabilities in XPages applications - ICS.UG 2016
Find your data - using GraphDB capabilities in XPages applications - ICS.UG 2016ICS User Group
 
Simplifying & accelerating application development with MongoDB's intelligent...
Simplifying & accelerating application development with MongoDB's intelligent...Simplifying & accelerating application development with MongoDB's intelligent...
Simplifying & accelerating application development with MongoDB's intelligent...Maxime Beugnet
 
A Presentation on MongoDB Introduction - Habilelabs
A Presentation on MongoDB Introduction - HabilelabsA Presentation on MongoDB Introduction - Habilelabs
A Presentation on MongoDB Introduction - HabilelabsHabilelabs
 
[Nuxeo World 2013] OPENING KEYNOTE - ERIC BARROCA, NUXEO CEO
[Nuxeo World 2013] OPENING KEYNOTE - ERIC BARROCA, NUXEO CEO[Nuxeo World 2013] OPENING KEYNOTE - ERIC BARROCA, NUXEO CEO
[Nuxeo World 2013] OPENING KEYNOTE - ERIC BARROCA, NUXEO CEONuxeo
 
In-browser storage and me
In-browser storage and meIn-browser storage and me
In-browser storage and meJason Casden
 
Cubes – pluggable model explained
Cubes – pluggable model explainedCubes – pluggable model explained
Cubes – pluggable model explainedStefan Urbanek
 

Similar to Who's afraid of front end databases (20)

Whos afraid of front end databases?
Whos afraid of front end databases?Whos afraid of front end databases?
Whos afraid of front end databases?
 
Who's afraid of front end databases?
Who's afraid of front end databases?Who's afraid of front end databases?
Who's afraid of front end databases?
 
Working with Data in Service Workers
Working with Data in Service WorkersWorking with Data in Service Workers
Working with Data in Service Workers
 
Intro to IndexedDB (Beta)
Intro to IndexedDB (Beta)Intro to IndexedDB (Beta)
Intro to IndexedDB (Beta)
 
Taking Web Apps Offline
Taking Web Apps OfflineTaking Web Apps Offline
Taking Web Apps Offline
 
ArangoDB – A different approach to NoSQL
ArangoDB – A different approach to NoSQLArangoDB – A different approach to NoSQL
ArangoDB – A different approach to NoSQL
 
The Fine Art of Schema Design in MongoDB: Dos and Don'ts
The Fine Art of Schema Design in MongoDB: Dos and Don'tsThe Fine Art of Schema Design in MongoDB: Dos and Don'ts
The Fine Art of Schema Design in MongoDB: Dos and Don'ts
 
Indexed db
Indexed dbIndexed db
Indexed db
 
Save your data
Save your dataSave your data
Save your data
 
HTML5 Storage/Cache
HTML5 Storage/CacheHTML5 Storage/Cache
HTML5 Storage/Cache
 
MongoDB and Schema Design
MongoDB and Schema DesignMongoDB and Schema Design
MongoDB and Schema Design
 
Academy PRO: HTML5 Data storage
Academy PRO: HTML5 Data storageAcademy PRO: HTML5 Data storage
Academy PRO: HTML5 Data storage
 
mongodb-120401144140-phpapp01 claud camputing
mongodb-120401144140-phpapp01 claud camputingmongodb-120401144140-phpapp01 claud camputing
mongodb-120401144140-phpapp01 claud camputing
 
Notes on SF W3Conf
Notes on SF W3ConfNotes on SF W3Conf
Notes on SF W3Conf
 
Find your data - using GraphDB capabilities in XPages applications - ICS.UG 2016
Find your data - using GraphDB capabilities in XPages applications - ICS.UG 2016Find your data - using GraphDB capabilities in XPages applications - ICS.UG 2016
Find your data - using GraphDB capabilities in XPages applications - ICS.UG 2016
 
Simplifying & accelerating application development with MongoDB's intelligent...
Simplifying & accelerating application development with MongoDB's intelligent...Simplifying & accelerating application development with MongoDB's intelligent...
Simplifying & accelerating application development with MongoDB's intelligent...
 
A Presentation on MongoDB Introduction - Habilelabs
A Presentation on MongoDB Introduction - HabilelabsA Presentation on MongoDB Introduction - Habilelabs
A Presentation on MongoDB Introduction - Habilelabs
 
[Nuxeo World 2013] OPENING KEYNOTE - ERIC BARROCA, NUXEO CEO
[Nuxeo World 2013] OPENING KEYNOTE - ERIC BARROCA, NUXEO CEO[Nuxeo World 2013] OPENING KEYNOTE - ERIC BARROCA, NUXEO CEO
[Nuxeo World 2013] OPENING KEYNOTE - ERIC BARROCA, NUXEO CEO
 
In-browser storage and me
In-browser storage and meIn-browser storage and me
In-browser storage and me
 
Cubes – pluggable model explained
Cubes – pluggable model explainedCubes – pluggable model explained
Cubes – pluggable model explained
 

More from Gil Fink

Becoming a Tech Speaker
Becoming a Tech SpeakerBecoming a Tech Speaker
Becoming a Tech SpeakerGil Fink
 
Web animation on steroids web animation api
Web animation on steroids web animation api Web animation on steroids web animation api
Web animation on steroids web animation api Gil Fink
 
The Time for Vanilla Web Components has Arrived
The Time for Vanilla Web Components has ArrivedThe Time for Vanilla Web Components has Arrived
The Time for Vanilla Web Components has ArrivedGil Fink
 
Stencil the time for vanilla web components has arrived
Stencil the time for vanilla web components has arrivedStencil the time for vanilla web components has arrived
Stencil the time for vanilla web components has arrivedGil Fink
 
Stencil the time for vanilla web components has arrived
Stencil the time for vanilla web components has arrivedStencil the time for vanilla web components has arrived
Stencil the time for vanilla web components has arrivedGil Fink
 
Stencil: The Time for Vanilla Web Components has Arrived
Stencil: The Time for Vanilla Web Components has ArrivedStencil: The Time for Vanilla Web Components has Arrived
Stencil: The Time for Vanilla Web Components has ArrivedGil Fink
 
Stencil the time for vanilla web components has arrived
Stencil the time for vanilla web components has arrivedStencil the time for vanilla web components has arrived
Stencil the time for vanilla web components has arrivedGil Fink
 
Being a tech speaker
Being a tech speakerBeing a tech speaker
Being a tech speakerGil Fink
 
Demystifying Angular Animations
Demystifying Angular AnimationsDemystifying Angular Animations
Demystifying Angular AnimationsGil Fink
 
One language to rule them all type script
One language to rule them all type scriptOne language to rule them all type script
One language to rule them all type scriptGil Fink
 
End to-end apps with type script
End to-end apps with type scriptEnd to-end apps with type script
End to-end apps with type scriptGil Fink
 
Web component driven development
Web component driven developmentWeb component driven development
Web component driven developmentGil Fink
 
Web components
Web componentsWeb components
Web componentsGil Fink
 
Redux data flow with angular 2
Redux data flow with angular 2Redux data flow with angular 2
Redux data flow with angular 2Gil Fink
 
Biological Modeling, Powered by AngularJS
Biological Modeling, Powered by AngularJSBiological Modeling, Powered by AngularJS
Biological Modeling, Powered by AngularJSGil Fink
 
Biological modeling, powered by angular js
Biological modeling, powered by angular jsBiological modeling, powered by angular js
Biological modeling, powered by angular jsGil Fink
 
Web components the future is here
Web components   the future is hereWeb components   the future is here
Web components the future is hereGil Fink
 
One language to rule them all type script
One language to rule them all type scriptOne language to rule them all type script
One language to rule them all type scriptGil Fink
 
Web Components - The Future is Here
Web Components - The Future is HereWeb Components - The Future is Here
Web Components - The Future is HereGil Fink
 
Getting Started with TypeScript
Getting Started with TypeScriptGetting Started with TypeScript
Getting Started with TypeScriptGil Fink
 

More from Gil Fink (20)

Becoming a Tech Speaker
Becoming a Tech SpeakerBecoming a Tech Speaker
Becoming a Tech Speaker
 
Web animation on steroids web animation api
Web animation on steroids web animation api Web animation on steroids web animation api
Web animation on steroids web animation api
 
The Time for Vanilla Web Components has Arrived
The Time for Vanilla Web Components has ArrivedThe Time for Vanilla Web Components has Arrived
The Time for Vanilla Web Components has Arrived
 
Stencil the time for vanilla web components has arrived
Stencil the time for vanilla web components has arrivedStencil the time for vanilla web components has arrived
Stencil the time for vanilla web components has arrived
 
Stencil the time for vanilla web components has arrived
Stencil the time for vanilla web components has arrivedStencil the time for vanilla web components has arrived
Stencil the time for vanilla web components has arrived
 
Stencil: The Time for Vanilla Web Components has Arrived
Stencil: The Time for Vanilla Web Components has ArrivedStencil: The Time for Vanilla Web Components has Arrived
Stencil: The Time for Vanilla Web Components has Arrived
 
Stencil the time for vanilla web components has arrived
Stencil the time for vanilla web components has arrivedStencil the time for vanilla web components has arrived
Stencil the time for vanilla web components has arrived
 
Being a tech speaker
Being a tech speakerBeing a tech speaker
Being a tech speaker
 
Demystifying Angular Animations
Demystifying Angular AnimationsDemystifying Angular Animations
Demystifying Angular Animations
 
One language to rule them all type script
One language to rule them all type scriptOne language to rule them all type script
One language to rule them all type script
 
End to-end apps with type script
End to-end apps with type scriptEnd to-end apps with type script
End to-end apps with type script
 
Web component driven development
Web component driven developmentWeb component driven development
Web component driven development
 
Web components
Web componentsWeb components
Web components
 
Redux data flow with angular 2
Redux data flow with angular 2Redux data flow with angular 2
Redux data flow with angular 2
 
Biological Modeling, Powered by AngularJS
Biological Modeling, Powered by AngularJSBiological Modeling, Powered by AngularJS
Biological Modeling, Powered by AngularJS
 
Biological modeling, powered by angular js
Biological modeling, powered by angular jsBiological modeling, powered by angular js
Biological modeling, powered by angular js
 
Web components the future is here
Web components   the future is hereWeb components   the future is here
Web components the future is here
 
One language to rule them all type script
One language to rule them all type scriptOne language to rule them all type script
One language to rule them all type script
 
Web Components - The Future is Here
Web Components - The Future is HereWeb Components - The Future is Here
Web Components - The Future is Here
 
Getting Started with TypeScript
Getting Started with TypeScriptGetting Started with TypeScript
Getting Started with TypeScript
 

Recently uploaded

+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 

Recently uploaded (20)

+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 

Who's afraid of front end databases

  • 1. WHO’S AFRAID OF FRONT-END DATABASES? Gil Fink CEO and Senior Consultant, sparXys @gilfink
  • 3. Cookies Are such an old technology…
  • 5.
  • 6. About Me • sparXys CEO and senior consultant • ASP.NET/IIS Microsoft MVP in the last 7 years • Pro Single Page Application Development (Apress) co-author • 4 Microsoft Official Courses (MOCs) co-author • GDG Rashlatz and Angular UP co-organizer
  • 8. Storing Data in The Browser • Cookies o Super small storage, string based, API not friendly • Web Storage (localStorage/sessionStorage) o String based dictionary, synchronous API • Web SQL database o Deprecated!
  • 10. IndexedDB • Advanced key-value data management IndexedDB Front-end App Fast Reliable Limited capacity Local access only Information loss
  • 11. IndexedDB • Made of records holding simple values or hierarchical objects o Each record is a key/value pair • Enables o Storage of large numbers of objects locally o Fast insertion and extraction • Satisfy some of the offline data requirements for web applications
  • 12. IndexedDB Database objectStore Cursor on objectStore key : value key : value key : value Index Cursor on index
  • 13. IndexedDB API • Very massive API! • API is asynchronous o Note: Synchronous APIs were deprecated by W3C • Exposed through window.indexedDB object
  • 14.
  • 15. IndexedDB – Open the Database var db; var request = window.indexedDB.open(“dbName"); request.onerror = function(event) { console.log(“Database error on open: ” + event.target.errorCode); }; request.onsuccess = function(event) { db = request.result; };
  • 16. IndexedDB – Creating an objectStore var request = indexedDB.open(‘dbName’, 2); request.onupgradeneeded = function(event) { // Create an objectStore to hold information about customers. var objectStore = db.createObjectStore(“products", { keyPath: “id" }); // Create an index to search customers by name. objectStore.createIndex("name", "name", { unique: false }); // Store value in the newly created objectStore. objectStore.add({ id: 3, name: “db“ }); };
  • 17. IndexedDB – Creating a Transaction var transaction = db.transaction([“products"], “readwrite”); transaction.oncomplete = function(event) { console.log(“Transaction completed”); }; transaction.onerror = function(event) { // handle transaction errors }; // will add the object into the objectStore var objectStore = transaction.objectStore(“products”); var request = objectStore.add({ id: 7, name: “IndexedDB" }); request.onsuccess = function(event) { // event.target.result == object.id }
  • 18. IndexedDB – Using a Cursor var transaction = db.transaction([“products”]); var objectStore = transaction.objectStore(“products”); var cursor = objectStore.openCursor(); cursor.onsuccess = function(event) { var cursor = event.target.result; if (cursor) { console.log(“id:”+cursor.key+” has name:”+cursor.value.name); cursor.continue(); } else { console.log(“No entries”); } };
  • 19. IndexedDB – Working with Indexes var transaction = db.transaction([“products”]); var objectStore = transaction.objectStore(“products”); var index = objectStore.index(“name”); var request = index.get(“IndexedDB"); request.onsuccess = function(event) { console.log(“id: " + event.target.result.id); };
  • 21. Problems? • Verbose syntax o Too much boilerplate • No support for queries style SQL • No full text search • And more
  • 22. Libraries to the Rescue • PouchDB - https://pouchdb.com/ o Good wrapper on top of IndexedDB with fallbacks • Working in Angular? o Angular 1 service - https://github.com/bramski/angular-indexedDB o angular2-indexeddb experimental service - https://github.com/gilf/angular2-indexeddb
  • 24. Summary • IndexedDB is a full blown database in your app’s front-end • It can help you to persist your front-end data • IndexedDB is suitable for offline scenarios
  • 25. Resources • IndexedDB on MDN - http://mzl.la/1u1sngQ • angular2-indexeddb - https://github.com/gilf/angular2-indexeddb • My Website – http://www.gilfink.net • Follow me on Twitter – @gilfink