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
window.navigator.language // -> "fr" | |
window.navigator.languages // -> ["fr-FR", "fr", "en-US", "en", "es", "de"] | |
window.navigator.userLanguage // -> undefined | |
window.navigator.browserLanguage // -> undefined | |
window.navigator.systemLanguage // -> undefined |
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 skipWaiting = () => self.skipWaiting(); | |
const unregister = (event) => { | |
event.waitUntil(self.clients.claim()); | |
self.registration.unregister() | |
.then(() => | |
console.log('Unregistered old service worker')); | |
}; | |
self.addEventListener('install', skipWaiting); |
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
{ | |
"version": 1, | |
"projects": { | |
"app": { | |
"architect": { | |
"stepper": { | |
"builder": "@ ng-builders / build: stepper", | |
"options": { | |
"targets": { // description of targets | |
"jest": { // target name and configuration |
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
export interface Target { | |
/ ** | |
* A list of target ids that must be completed before starting the task | |
* | |
* Differs from Schema#steps in that the task does not wait for the full | |
* performing dependent tasks | |
* / | |
deps?: string[]; | |
/ ** | |
* Purpose to fulfill |
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
// index.ts | |
export function runStepper( | |
input: Schema, | |
context: BuilderContext | |
): BuilderOutputLike { | |
return buildSteps(input, context).pipe ( | |
map(() => ({ | |
success: true | |
})), | |
catchError(error => { |
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
// index.ts | |
function buildSteps(config: Schema, context: BuilderContext): Observable<any> { | |
return concat( | |
config.steps.map(step => buildStep(step, config.targets, context)) | |
); | |
} |
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
// index.ts | |
function buildStep( | |
stepName: string, | |
targets: Targets, | |
context: BuilderContext | |
): Observable<any> { | |
const {deps = [], overrides, target, watch}: Target = targets[stepName]; | |
const deps$ = deps.length | |
? combineLatest(deps.map(depName => buildStep(depName, targets, context))) |
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
{ | |
"$ schema": "../../@angular-devkit/architect/src/builders-schema.json", | |
"builders": { | |
"stepper": { | |
"implementation": "./stepper", | |
"schema": "./schema.json", | |
"description": "Stepper" | |
} | |
} | |
} |
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 items = [1, 2, 3, 4]; | |
//before | |
const first = items[0]; | |
//after | |
const first = items.first; |
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 items = [1, 2, 3, 4]; | |
//before | |
const last = items[items.length - 1]; | |
//after | |
const last = items.last; |
OlderNewer