DEV Community

Asynchronous post challenge

Bertil Muth on June 05, 2018

You create a website. It contains 2 text fields, with a single digit number each. When the user changes the value of a text field, the client tran...
Collapse
 
bgadrian profile image
Adrian B.G.

Vanilla JS: use localStorage to keep the values (in order they were typed), and check when connections is online send the events from the queue. (local storage or indexedDB).

Any offline capable framework like Google Firestore, AWS APPSync ....

Collapse
 
nektro profile image
Meghan (she/her)

This sounds like a great use for Pusher!

Collapse
 
ben profile image
Ben Halpern

I'm a little confused by the problem being posed. Do you need to give the user a confirmation that the async task finished?

Collapse
 
bertilmuth profile image
Bertil Muth

What I meant In the optional extra: give the user confirmation that the server actually received the data.

So sending is one thing and sufficient in terms of the challenge.
Confirmation of reception by the server would be the cherry on top. Does that help?

Collapse
 
bertilmuth profile image
Bertil Muth

In more technical terms: setting the check box as a reaction to a HTTP status ok response from the server qualifies for the optional extra.

Collapse
 
davidszabo97 profile image
DΓ‘vid SzabΓ³ • Edited

A solution can be found here:
github.com/david-szabo97/devto-cha...

Collapse
 
bertilmuth profile image
Bertil Muth

Tried it today on a train ride. Works fine :)

Collapse
 
bertilmuth profile image
Bertil Muth

Fantastic. I will try it out.

Collapse
 
cjbrooks12 profile image
Casey Brooks

You might take a look at PouchDB

Collapse
 
gnolem profile image
gnolem

App cache, service worker, local storage and Ajax call. I would stick to plain JavaScript.

Collapse
 
gaserd profile image
Sergey Gustun

This is nice question.

Pls, read this github.com/logux

Collapse
 
bertilmuth profile image
Bertil Muth

Who’s going to be the heroIne who posts code?