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 TrafficLight = function () { | |
var count = 0; | |
var currentState = new Red(this); | |
this.change = function (state) { | |
// limits number of changes | |
if (count++ >= 10) return; | |
currentState = state; | |
currentState.go(); | |
}; |
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
/** @license React v16.1.0-beta | |
* react-reconciler.development.js | |
* | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* | |
* This source code is licensed under the MIT license found in the | |
* LICENSE file in the root directory of this source tree. | |
*/ | |
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
/* | |
React v16.1.0-beta | |
react-reconciler.production.min.js | |
Copyright (c) 2013-present, Facebook, Inc. | |
This source code is licensed under the MIT license found in the | |
LICENSE file in the root directory of this source tree. | |
*/ | |
'use strict';var Va; |
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
/** @license React v16.1.0-beta | |
* react-dom.development.js | |
* | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* | |
* This source code is licensed under the MIT license found in the | |
* LICENSE file in the root directory of this source tree. | |
*/ | |
(function (global, factory) { |
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
/* | |
React v16.1.0-beta | |
react-dom.production.min.js | |
Copyright (c) 2013-present, Facebook, Inc. | |
This source code is licensed under the MIT license found in the | |
LICENSE file in the root directory of this source tree. | |
Modernizr 3.0.0pre (Custom Build) | MIT | |
*/ |
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 Click() { | |
this.handlers = []; // observers | |
} | |
Click.prototype = { | |
subscribe: function(fn) { | |
this.handlers.push(fn); | |
}, | |
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 Flyweight (make, model, processor) { | |
this.make = make; | |
this.model = model; | |
this.processor = processor; | |
}; | |
var FlyWeightFactory = (function () { | |
var flyweights = {}; | |
return { |
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
/** | |
* This is sample code which represents command pattern. | |
* A command pattern basically instructs a function to perform some actions. | |
* It is a function call wrapped in an object and very useful where we want a layer of abstraction between the action creator and the action to be performed | |
*/ | |
// Action | |
function add(a, b) { | |
return a + b | |
} |
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 some_module = require('some_module') | |
/** | |
* require('some_module') calls Module._load | |
* | |
* Module._load then tries to load the module with a filename (also save it to the cache) using module.load(filename) | |
* | |
* module.load(filename), given a filename, passes it to the proper extension handler ('.js', '.json') | |
* | |
* If there were any errors when loading the file, it deletes the file from the cache (delete Module._cache[filename]) and throws an error |
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
let HEAP = []; | |
const A = { | |
language: 'JavaScript' | |
}; | |
HEAP.push(A); | |
const root = () => HEAP[0]; |