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
import { Component } from '@angular/core'; | |
import { Store, Select } from '@ngxs/store'; | |
import { Observable } from 'rxjs'; | |
import { Dispatch } from '@ngxs-labs/dispatch-decorator' | |
import { CountState } from './store/counter/count.state'; | |
import { Increment, Decrement } from './store/counter/count.actions'; | |
@Component({ | |
selector: 'my-app', |
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
export class Increment { | |
public static readonly type = '[Counter] Increment'; | |
} | |
export class Decrement { | |
public static readonly type = '[Counter] Decrement'; | |
} |
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
import { State, Action } from '@ngxs/store'; | |
import { Increment, Decrement } from './count.actions'; | |
@State<number>({ | |
name: 'count', | |
defaults: 0 | |
}) | |
export class CountState { | |
@Action(Increment) public increment({ setState }) { | |
setState(state => ++state); |
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
<script src="https://unpkg.com/redux@latest/dist/redux.min.js"></script> | |
<p> | |
Counter: <span id="value">0</span> | |
<button id="increment">+</button> | |
<button id="decrement">-</button> | |
</p> | |
<script> | |
function counterReducer(state, action) { |
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
/*! highlight.js v9.15.9 | BSD3 License | git.io/hljslicense */ | |
!function(e){var n="object"==typeof window&&window||"object"==typeof self&&self;"undefined"==typeof exports||exports.nodeType?n&&(n.hljs=e({}),"function"==typeof define&&define.amd&&define([],function(){return n.hljs})):e(exports)}(function(a){var f=[],u=Object.keys,N={},c={},n=/^(no-?highlight|plain|text)$/i,s=/\blang(?:uage)?-([\w-]+)\b/i,t=/((^(<[^>]+>|\t|)+|(?:\n)))/gm,r={case_insensitive:"cI",lexemes:"l",contains:"c",keywords:"k",subLanguage:"sL",className:"cN",begin:"b",beginKeywords:"bK",end:"e",endsWithParent:"eW",illegal:"i",excludeBegin:"eB",excludeEnd:"eE",returnBegin:"rB",returnEnd:"rE",relevance:"r",variants:"v",IDENT_RE:"IR",UNDERSCORE_IDENT_RE:"UIR",NUMBER_RE:"NR",C_NUMBER_RE:"CNR",BINARY_NUMBER_RE:"BNR",RE_STARTERS_RE:"RSR",BACKSLASH_ESCAPE:"BE",APOS_STRING_MODE:"ASM",QUOTE_STRING_MODE:"QSM",PHRASAL_WORDS_MODE:"PWM",C_LINE_COMMENT_MODE:"CLCM",C_BLOCK_COMMENT_MODE:"CBCM",HASH_COMMENT_MODE:"HCM",NUMBER_MODE:"NM",C_NUMBER_MODE:"CNM", |
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
data = data.mergeDeep({ | |
items: { | |
[NEW_ITEM_ID]: { id: NEW_ITEM_ID, name: 'ITEM-NEW', value: 0 } | |
}, | |
keys: [ ...INITIAL_DATA.keys, NEW_ITEM_ID], | |
count: (data.get('count') as number) + 1 | |
}); |
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 checkLanguage(greeter, closing){ | |
if (closing) { | |
const newGreeter = clone(greeter); | |
newGreeter.greeting = 'Goodbye'; | |
return newGreeter; | |
} | |
return greeter; | |
} | |
const foo = { greeting: 'Hello' }; |
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 checkLanguage(greeter, closing){ | |
if (closing) { | |
greeter.greeting = 'Goodbye'; | |
} | |
} |
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 foo = { greeting: 'Hello' }; | |
checkLanguage(foo, true); | |
console.log(foo.greeting + ' world!'); |
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
// XML Documentation: | |
// tslint:disable-next-line:max-line-length | |
// https://docs.microsoft.com/en-us/previous-versions/office/developer/office-xp/aa140066(v=office.10)#odc_xmlss_ss:column |