made with esnextbin
Created
January 17, 2019 16:47
-
-
Save voronianski/3c1f90c41b014004a4c597b4e92b116b to your computer and use it in GitHub Desktop.
esnextbin sketch
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"> | |
<title>ESNextbin Sketch</title> | |
</head> | |
<body> | |
</body> | |
</html> |
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 chatbot = Promise.resolve(); | |
const logger = str => function () { | |
console.log(str); | |
}; | |
const delay = ms => function () { | |
return new Promise(resolve => { | |
setTimeout(resolve, ms); | |
}); | |
}; | |
const phrases = [ | |
'hello', | |
'what are you doing?', | |
'bye :)' | |
]; | |
phrases.forEach((phrase, i) => { | |
delay(i * 1000)().then(() => { | |
logger(phrase)(); | |
}); | |
}); |
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
{ | |
"name": "esnextbin-sketch", | |
"version": "0.0.0", | |
"dependencies": { | |
"vue": "2.1.10", | |
"vee-validate": "2.0.0-beta.18" | |
} | |
} |
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'; | |
var _promise = require('babel-runtime/core-js/promise'); | |
var _promise2 = _interopRequireDefault(_promise); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | |
var chatbot = _promise2.default.resolve(); | |
var logger = function logger(str) { | |
return function () { | |
console.log(str); | |
}; | |
}; | |
var delay = function delay(ms) { | |
return function () { | |
return new _promise2.default(function (resolve) { | |
setTimeout(resolve, ms); | |
}); | |
}; | |
}; | |
var phrases = ['hello', 'what are you doing?', 'bye :)']; | |
phrases.forEach(function (phrase, i) { | |
delay(i * 1000)().then(function () { | |
logger(phrase)(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment