- timeout(5e3);
+ await timeout(5e3);
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
function work() { | |
console.log('do work'); | |
} | |
function main() { | |
console.log('main start'); | |
work(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
function timeout(ms) { | |
console.log('timeout start'); | |
return new Promise(resolve => { | |
setTimeout(() => { | |
console.log(`timeout cb fired after ${ms} ms`); | |
resolve(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
function timeout(ms) { | |
console.log('timeout start'); | |
return new Promise(resolve => { | |
setTimeout(() => { | |
console.log(`timeout cb fired after ${ms} ms`); | |
resolve(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<style> | |
#container { | |
background: #ddd; | |
transition: transform 0.5s; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Make sure the following is included in `/test/index.js` | |
* | |
* ```javascript | |
* 'use strict'; | |
* | |
* const mocha = require('mocha'); | |
* const coMocha = require('co-mocha'); | |
* | |
* coMocha(mocha); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const data = { | |
entry: [ | |
{ | |
messaging: [ | |
{ | |
senderId: 1, | |
payload: { | |
text: 'hello' | |
} | |
} |