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
| // Future versions of Hyper may add additional config options, | |
| // which will not automatically be merged into this file. | |
| // See https://hyper.is#cfg for all currently supported options. | |
| module.exports = { | |
| config: { | |
| // choose either `'stable'` for receiving highly polished, | |
| // or `'canary'` for less polished but more frequent updates | |
| updateChannel: 'stable', | |
| // default font size in pixels for all tabs | |
| fontSize: 12, |
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
| const ServiceStorageAdapter = () => { | |
| const adapter = {}; | |
| adapter.getAll = function () { | |
| return fetch('/shopping') | |
| .then(function (response) { | |
| return response.json(); | |
| }) | |
| } |
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
| class Database { | |
| constructor(data) { | |
| if (Database.exists) { | |
| return Database.instance; | |
| } | |
| Database.instance = this; | |
| Database.exists = true; | |
| this._data = data; |
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 myCar = { | |
| name: "Ford Escort", | |
| drive: function () { | |
| console.log( "Weeee. I'm driving!" ); | |
| }, | |
| panic: function () { | |
| console.log( "Wait. How do you stop this thing?" ); | |
| } | |
| }; |
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
| // PATTERN FACTORY USING CLASS | |
| class Bicycle { | |
| constructor() { | |
| this.vehicle = 'Bicycle'; | |
| this.wheels = 2; | |
| this.speedMax = 20; | |
| } | |
| } | |
| class Car { |
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
| function Pokemon(type, power) { | |
| this.type = type; | |
| this.power = power; | |
| this.say() { | |
| return `I am ${this.type} and my power is ${this.power}`; | |
| } | |
| } | |
| // es6 | |
| class Pokemon { |
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
| /* | |
| example 1 | |
| */ | |
| import { from } from 'rxjs'; | |
| import { filter, map } from 'rxjs/operators'; | |
| const arraySource = from([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); | |
| arraySource.pipe( |
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 observable = Rx.Observable.create(function (observer) { | |
| observer.next(1); | |
| observer.next(2); | |
| observer.next(3); | |
| setTimeout(() => { | |
| observer.next(4); | |
| observer.complete(); | |
| }, 1000); | |
| }); |
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
| /* | |
| * Without reactive paradigm | |
| */ | |
| class Car { | |
| constructor(sales) { | |
| this.items = []; | |
| this.sales = sales; | |
| } | |
| add(item) { |
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
| /* | |
| secuencia de eventos | |
| */ | |
| document.addEventListener('click', (e) => console.log('Clicked!', e.clientX)); | |
| /* | |
| usando rxjs | |
| */ | |
| import { fromEvent } from 'rxjs'; |
NewerOlder