This file contains 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
@Component({ | |
selector: 'wt-logo', | |
template: ` | |
<img [src]="getLogoUrl()"> | |
<button (click)="company = 'wishtack'">WISHTACK</button> | |
<button (click)="company = 'google'">GOOGLE</button> | |
` | |
}) | |
export class LogoComponent { |
This file contains 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
recognition = new webkitSpeechRecognition(); | |
recognition.continuous = true; | |
recognition.lang = 'fr-FR'; | |
recognition.onresult = console.log; | |
recognition.start(); |
This file contains 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
@Component({ | |
selector: 'wt-title-v1', | |
template: `<h1>v1: {{ title }}</h1>` | |
}) | |
export class TitleV1Component { | |
@Input() title: string; | |
} | |
@NgModule({ | |
imports: [CommonModule], |
This file contains 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
/** | |
* @todo when `deps` will be added to `Component` definition, | |
* we could return `{deps, template}` then use it like this: | |
* ``` | |
* @Component({ | |
* selector: 'wt-root', | |
* ...ngTemplate`<${Child}></${Child}>` | |
* }) | |
* ``` |
This file contains 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
@Component({ | |
template: `` | |
}) | |
export class AppComponent extends Renderable { | |
render() { | |
return ( | |
<h1>Hello World!</h1> | |
) | |
} | |
} |
This file contains 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
@NgModule({ | |
imports: [ | |
RoutingModule.forRoot([ | |
{ | |
path: 'sandwich', | |
loadChildren: './sandwich/sandwich-views.module#SandwichViewsModule' | |
} | |
]) | |
] | |
}) |
This file contains 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
@NgModule({ | |
imports: [ | |
RoutingModule.forChild([ | |
{ | |
path: 'catalog', | |
# Or, you can lazy load catalog if you wish. | |
component: SandwichCatalogViewComponent | |
} | |
]), | |
SandwichCatalogViewModule |
This file contains 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 u1 = {firstName: 'Foo'} | |
const u2 = {firstName: 'John'} | |
const body = JSON.parse('{"__proto__": {"admin": true}}') | |
function vulnerableExtend(dst, src) { | |
Object.entries(src) | |
.forEach(([k, v]) => { | |
if (k in dst) { | |
vulnerableExtend(dst[k], src[k]); |
This file contains 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
/** | |
* @hack detect when story is changed and reload because custom elements | |
* break HMR. | |
* Storybook will replace storybook-dynamic-app-root's children. | |
* Then we reload the page to redefine elements. | |
*/ | |
const rootEl = document.querySelector('#root'); | |
rootEl.addEventListener('DOMNodeRemoved', (evt) => { | |
if (evt.relatedNode === rootEl) { | |
document.location.reload(); |
This file contains 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 { switchMap } from 'rxjs/operators'; | |
action$; | |
state$; // facade.country$ etc... | |
repository$; | |
fetch$.pipe(withLatestFrom(facade.country$)); | |
waitLatestFrom = (action$) => | |
action$.pipe( |