API for ReactArToolKit component is experimental
| Property | Type | Default | Supported values |
|---|
| 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 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 | |
| } |
| function Flyweight (make, model, processor) { | |
| this.make = make; | |
| this.model = model; | |
| this.processor = processor; | |
| }; | |
| var FlyWeightFactory = (function () { | |
| var flyweights = {}; | |
| return { |
| function Click() { | |
| this.handlers = []; // observers | |
| } | |
| Click.prototype = { | |
| subscribe: function(fn) { | |
| this.handlers.push(fn); | |
| }, | |
| /* | |
| 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 | |
| */ |
| /** @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) { |
| /* | |
| 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; |
| /** @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. | |
| */ | |
| 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(); | |
| }; |