Skip to content

Instantly share code, notes, and snippets.

@gktaj
gktaj / index.md
Created July 30, 2019 09:42 — forked from gnapse/index.md
Promise vs async/await

then(onSuccess).catch(onFailure)

This one catches errors not only during the ajax request, but during the onSuccess handler execution.

const response = ajax(options).then(onSuccess).catch(onFailure)

The appropriate translation to async/await could be something like this:

@gktaj
gktaj / db.json
Created June 20, 2019 07:08
db.json
[
{
"color": "black",
"category": "hue",
"type": "primary",
"code": {
"rgba": [255,255,255,1],
"hex": "#000"
}
},