This code is a fleshed-out version of the example [here][flux-docs]. Make sure to build Flux before running this example:
cd node_modules/flux
npm install
cd ../..
npm start| <div class="Container"> | |
| <h1 class="Container-title">Container</h1 | |
| <p>A normal container.</p> | |
| </div> | |
| <div class="Container Container--raised"> | |
| <h1 class="Container-title">Raised Container</h1> | |
| <p>A <em>raised</em> container.</p> | |
| </div> | |
| <div class="Container is-active"> | |
| <h1 class="Container-title">Active Container</h1 |
| node_modules | |
| components |
| node_modules |
| 'use strict'; | |
| var Promise = require('es6-promise'); | |
| // See http://www.html5rocks.com/en/tutorials/es6/promises/ | |
| module.exports = function sequencePromises (promises, transformFn) { | |
| function identity (x) { return x; } | |
| return promises.reduce(function (sequence, promise) { | |
| return sequence.then(function () { | |
| return promise; |
| 'use strict'; | |
| var fs = require('fs'); | |
| var os = require('os'); | |
| var vm = require('vm'); | |
| var marked = require('marked'); | |
| var argv = require('minimist')(process.argv.slice(2)); | |
| var usage = function () { | |
| var helpText = [ |
| // `replaceTokens` is a modification of Crockford's `String.prototype.supplant` | |
| // which takes works on an object/array (if given as the second argument) | |
| // or a variable number of replacements. | |
| module.exports = function replaceTokens (tmpl/*, replacements... */) { | |
| var args = [].slice.call(arguments, 1); | |
| if (args[0] != null && (Array.isArray(args[0]) || typeof args[0] === 'object')) { | |
| args = args[0]; | |
| } | |
| return tmpl.replace(/\{([^{}]*)\}/g, function (match, index) { | |
| var result = args[index]; |
| # Prompt colors | |
| RESET_COLOR="\[\e[0m\]" | |
| RED="\[\e[31m\]" | |
| GREEN="\[\e[32m\]" | |
| YELLOW="\[\e[33m\]" | |
| BLUE="\[\e[34m\]" | |
| MAGENTA="\[\e[35m\]" | |
| CYAN="\[\e[36m\]" | |
| WHITE="\[\e[37m\]" | |
| BOLD_GRAY="\[\e[30;1m\]" |
| body { padding-top: 70px; } |
| 'use strict'; | |
| var hashpress = require('./hashpress'); | |
| var obj = { | |
| username: 'foo', | |
| likes: ['cats', 'candy'], | |
| quote: "I don't always program JavaScript...but when I do, I use Node.js" | |
| }; |