This file contains hidden or 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
export const myObject = {one: `two`}; | |
export const myNumber = 42; | |
export const myBoolean = true; | |
export default () => console.log(`Exported arrow-function`); |
This file contains hidden or 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
# JAVASCRIPTING | |
## __INTRODUCTION__ (_Exercise 1 of 19_) | |
To keep things organized, let's create a folder for this workshop. | |
Run this command to make a directory called `javascripting` (or something else if you like): | |
```bash |
This file contains hidden or 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
var Yeelight = require('node-yeelight'); | |
var y = new Yeelight; | |
y.on('ready', function() { | |
y.discover(); // scan network for active Yeelights | |
console.log('discover'); | |
}); | |
y.listen(); |
This file contains hidden or 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
var begin = function(i) { | |
console.log(i + 'this is the start'); | |
setTimeout(function cb() { | |
console.log(i + 'this is a msg from call back'); | |
}); | |
console.log(i + 'this is just a message'); |
This file contains hidden or 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
// На просторах интернетов нашел такой паттерн с `exit`: | |
// 1. В сабмодулях не используется `exit`, чтобы избежать проблем с отладкой и пониманием и т.д. и т.п. | |
// 2. В сабмодулях если надо кидается exception `throw new Error('Все пропало, шеф!')` | |
// 3. exit разрешен только во входной точке | |
// Входная точка должна выглядеть как-то так: | |
var subModule = require('sub-module'); | |
var exit = process.exit; |