#Comprehensive Introduction to @ngrx/store 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!
#Comprehensive Introduction to @ngrx/store 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!
| interface Functor { | |
| fmap: (any) => any; | |
| } | |
| interface Monad extends Functor { | |
| bind: (any) => Monad; | |
| } | |
| interface Maybe extends Monad { | |
| } |
| interface Functor { | |
| fmap: (any) => any; | |
| } | |
| interface Monad extends Functor { | |
| bind: (any) => Monad; | |
| } | |
| interface MaybeMatcher { | |
| just: (any) => Maybe; |
| // App | |
| import { Component } from '@angular/core'; | |
| @Component({ | |
| selector: 'app', | |
| template: '<span>{{ sayHello() }}</span>', | |
| }) | |
| export class App { | |
| public name: string = 'John'; |
| module.exports = Maybe; | |
| function Maybe(x) { | |
| this._value = x; | |
| } | |
| Maybe.of = of; | |
| Maybe.empty = empty; | |
| var nothingValue = void 0; |
| // install @types/react-redux and other nonsense | |
| import * as React from 'react' | |
| import { connect } from 'react-redux' | |
| import { YourActualAppState } from './wherever-it-is.ts' | |
| export function mapStateToProps({ | |
| whatever | |
| }: YourActualAppState) { | |
| return { |
| // Pragmatic typed immutable.js records using typescript 2.1+ | |
| // Comment with any suggestions/improvements! | |
| import * as fs from 'fs' | |
| import { Record, Map } from 'immutable' | |
| type Stats = fs.Stats; | |
| // Define the basic shape. All properties should be readonly. This model | |
| // defines a folder because it seemed easy C: |
| /* Numerics for Doyle spirals. | |
| * Robin Houston, 2013 | |
| */ | |
| (function() { | |
| var pow = Math.pow, | |
| sin = Math.sin, | |
| cos = Math.cos, | |
| pi = Math.PI; | |
| using System; | |
| using System.Collections; | |
| using System.Collections.Generic; | |
| /* | |
| A basic lens library for the purpose of demonstration. | |
| Implements a lens as the costate comonad coalgebra. | |
| This library is not complete. | |
| A more complete lens library would take from |
| /** | |
| * This short program will encrypt the user password | |
| * and insert a new record into a mock database. | |
| */ | |
| const Reader = require('fantasy-readers'); | |
| const R = require('ramda'); | |
| const crypto = require('crypto'); | |
| // our mock database | |
| const database = [ |