This is your captain speaking
please put your phone in airplane mode

Olivier Leplus

@olivierleplus

—Pilote

@olivierleplus

bit.ly/botfuel-sdk

Let's have more fun.

LIVE CODING TIME !

client.js

sw.js

Internet

This is you

local DB

  • save image to local DB

 

  • register sync
  • trigger sync event
  • Retrieve from DB
  • upload to the internet

IndexedDb

This is a tiny library that mirrors IndexedDB, but replaces the weird IDBRequest objects with promises, plus a couple of other small changes.


— Jake Archibald

https://github.com/jakearchibald/idb

Indexed Database API

async/await

 

Promise-based implementation with the advantage of the synchronous-looking generator style.

— Nicolás Bevacqua

https://ponyfoo.com/articles/understanding-javascript-async-await

function getFirstUser() {
    return getUsers().then(function(users) {
        return users[0].name;
    });
}
getFirstUser().then(user => {
    console.log(user);
}
async function getFirstUser() {
    const users = await getUsers();
    return users[0].name;
}

const user = getFirstUser();
const a = await getA();
const b = await getB();
const c = await getC();

 @olivierleplus

Thanks.

Made with Slides.com