By: @BTroncone
Also check out my lesson @ngrx/store in 10 minutes on egghead.io!
Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
| <meta name="viewport" content="width=device-width, intial-scale=1.0"> | |
| <meta name="apple-mobile-web-app-capable" content="yes"> | |
| <meta name="mobile-web-app-capable" content="yes"> |
| brew install node --without-npm mkdir "${HOME}/.npm-packages" echo NPM_PACKAGES="${HOME}/.npm-packages" >> ${HOME}/.bashrc echo prefix=${HOME}/.npm-packages >> ${HOME}/.npmrc curl -L https://www.npmjs.org/install.sh | sh echo NODE_PATH=\"\$NPM_PACKAGES/lib/node_modules:\$NODE_PATH\" >> ${HOME}/.bashrc echo PATH=\"\$NPM_PACKAGES/bin:\$PATH\" >> ${HOME}/.bashrc echo source "~/.bashrc" >> ${HOME}/.bash_profile source ~/.bashrc |
| function getFile(file) { | |
| return new Promise( | |
| (resolve,reject) => { | |
| if (Math.random()>0.3) fakeAjax(file,resolve); | |
| else reject('SOMETHING GO WRONG WITH '+file); | |
| } | |
| ); | |
| } | |
| function Async(gen){ |
| export class FormController { | |
| static $inject = ["XeApiSvc", "MsgboxSvc"]; | |
| constructor(private api: Services.XeApiSvc, private msg: Services.MsgboxSvc) { | |
| this.inInsert = false; | |
| } | |
| public data: Models.IRegistration; | |
| public toggleInsert() { |
| // Rollup plugins to install as npm --save-dev | |
| import typescript from "rollup-plugin-typescript";//used for typescript compilation | |
| import resolve from "rollup-plugin-node-resolve"; //used for enabel NPM modules + | |
| import commonjs from "rollup-plugin-commonjs"; //with probably use commonjs | |
| import replace from "rollup-plugin-replace"; //used for replacing ENV varible in code | |
| import uglify from "rollup-plugin-uglify"; //used for production minification | |
| // import angular from "rollup-plugin-angular"; //used for Angular2 application see https://www.npmjs.com/package/rollup-plugin-angular | |
| // Rollup configuration inspired by https://www.youtube.com/watch?v=ICYLOZuFMz8 | |
| export default { | |
| entry: "path/to/main.ts", //entrypoint to traverse app |
| //ES6detect - inspired by https://github.com/bevacqua/sixflix - Algorithm by Netflix | |
| var detection = 'class ಠ_ಠ extends Array{constructor(j=`a`,...c){const q=(({u: e})=>{return {[`${c}`]:Symbol(j)};})({});super(j,q,...c)}}new Promise(f=>{const a=function*(){return "\u{20BB7}".match(/./u)[0].length===2||!0};for (let z of a()){const [x,y,w,k]=[new Set(),new WeakSet(),new Map(), new WeakMap()];break}f(new Proxy({},{get:(h,i) =>i in h ?h[i]:"j".repeat(0o2)}))}).then(t => new ಠ_ಠ(t.d))' | |
| var result | |
| module.exports = function () { | |
| if (result === void 0) { | |
| try { | |
| eval(detection) | |
| result = true |
| //CODE by Andrea Giammarchi - READ MORE: http://webreflection.blogspot.it/2009/06/wait-moment-javascript-does-support.html | |
| Object.implement = function(o, constructor){ | |
| // Another WebReflection Insane Snippet | |
| if(o instanceof constructor) | |
| // nothing to check | |
| // classical boring stuff | |
| return true; | |
| // let's check if things are OK | |
| var k, b = true, | |
| // take the instance constructor prototype |
| //inspired by https://github.com/bevacqua/fuzzysearch/blob/master/index.js | |
| 'use strict'; | |
| function fuzzysearch (what, inside) { | |
| var l = inside.length; | |
| var n = what.length; | |
| if (n > l) { | |
| return false; | |
| } | |
| if (n === l) { |
| // Code inspired by http://www.anasfirdousi.com/share-controlvalueaccessor-provider-creation-with-abstract-controlvalueaccessor-across-custom-form-enabled-angular-components.html | |
| import { Component, Directive, Provider, forwardRef, Type } from '@angular/core'; | |
| import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; | |
| export abstract class AbstractValueAccessor<T> implements ControlValueAccessor { | |
| private _value: T = ''; | |
| public get value(): T { return this._value; }; | |
| public set value(v: T) { | |
| if (v !== this._value) { | |
| this._value = v; |
By: @BTroncone
Also check out my lesson @ngrx/store in 10 minutes on egghead.io!
Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!