Gmail Android
Play Music Android
Whatsapp Android
This Is Called Lie-Fi. Your Phone Has No Signal, But It Makes You Believe It Does.
Web App
Service Worker
Server
Users are case workers
They Interview their clients off site
The clients fill a questionnaire
They go back to office & Fill on their PC
{
"ok" : true,
"_id" : "8A2C3761-FFD5-4770-9B8C-38C33CED300A",
"_rev" : "1-d3a8e0e5aa7c8fff0c376dac2d8a4007"
}
db.put({
_id: 'dave@gmail.com',
name: 'David',
age: 69
});
db.post({
name: 'David',
age: 69
});
db.get('mydoc');
db.remove({
_id: 'docID',
_rev: 'docRev'
});
View
Model
View
Model
Cloud DB
Remember Firebase?
View
Model
Cloud DB
Local DB
var sync = PouchDB.sync('mydb', 'http://localhost:5984/mydb', {
live: true,
retry: true
}).on('change', function (info) {
// handle change
}).on('paused', function (err) {
// replication paused (e.g. replication up to date, user went offline)
}).on('active', function () {
// replicate resumed (e.g. new changes replicating, user went back online)
}).on('denied', function (err) {
// a document failed to replicate (e.g. due to permissions)
}).on('complete', function (info) {
// handle complete
}).on('error', function (err) {
// handle error
});
sync.cancel(); // whe
IBM Cloudant Is Great :)
db.find({
selector: {name: 'Mario'},
fields: ['_id', 'name'],
sort: ['name']
});
db.find({
selector: {
series: 'Mario',
debut: { $gt: 1990 }
}
}
Kevin Perree (https://github.com/numerized)
Offline First Is Ever Developer's Responsibility In 2017
Always Think About Conflicts
If The Word "CONFLICT" Doesn't Appear In The Docs, It's Not Offline First
Hausa For Any Questions?