├── .editorconfig ├── .firebase └── hosting.ZGlzdFxjb3VudGRvd24tcnhqcw.cache ├── .firebaserc ├── .gitignore ├── README.md ├── angular.json ├── browserslist ├── e2e ├── protractor.conf.js ├── src │ ├── app.e2e-spec.ts │ └── app.po.ts └── tsconfig.json ├── firebase.json ├── karma.conf.js ├── package-lock.json ├── package.json ├── src ├── app │ ├── app.component.css │ ├── app.component.html │ ├── app.component.spec.ts │ ├── app.component.ts │ ├── app.module.ts │ ├── components │ │ ├── countdown │ │ │ ├── countdown.component.css │ │ │ ├── countdown.component.html │ │ │ ├── countdown.component.spec.ts │ │ │ └── countdown.component.ts │ │ └── time-input │ │ │ ├── time-input.component.css │ │ │ ├── time-input.component.html │ │ │ ├── time-input.component.spec.ts │ │ │ └── time-input.component.ts │ ├── directives │ │ ├── input-to-countdown.directive.spec.ts │ │ └── input-to-countdown.directive.ts │ ├── pipes │ │ ├── time-format.pipe.spec.ts │ │ └── time-format.pipe.ts │ ├── services │ │ ├── contentful.service.spec.ts │ │ ├── contentful.service.ts │ │ ├── synthesis.service.spec.ts │ │ └── synthesis.service.ts │ └── snippets.md ├── assets │ └── .gitkeep ├── environments │ ├── environment.prod.ts │ └── environment.ts ├── favicon.ico ├── index.html ├── main.ts ├── polyfills.ts ├── styles.css └── test.ts ├── tsconfig.app.json ├── tsconfig.json ├── tsconfig.spec.json └── tslint.json /.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /.firebase/hosting.ZGlzdFxjb3VudGRvd24tcnhqcw.cache: -------------------------------------------------------------------------------- 1 | index.html,1568465112767,768a70fde5739ef0af8d87e38fa5ae36bd0025ea4760c40ce28579ec164ae233 2 | favicon.ico,1568465112723,3b78f993f13027179977aaa04a5398b7d6832af035f0aacd1e517ff2c628464a 3 | 3rdpartylicenses.txt,1568465112723,1f556a9d5cdea8d2dc01775bcb739287691d76e38a1e4685ff5e9ddebef533dc 4 | polyfills-es2015.edf60e92366a5a261979.js,1568465112723,5b7fff362de4188781b49e77f445063b1e8dda52723a0c93ddde14485151220e 5 | runtime-es5.741402d1d47331ce975c.js,1568465090443,6defac21e896959ee0c165c6e34da9d4262692855dbd42ea0111f7662f4db473 6 | runtime-es2015.858f8dd898b75fe86926.js,1568465112723,6defac21e896959ee0c165c6e34da9d4262692855dbd42ea0111f7662f4db473 7 | styles.7c49c2f2607718f0a1b8.css,1568465112723,1f7cfe4abe1223d6c2b9897d0d9ca9e164e1d7bd6f8f1410cb5eb5be6b61fc0f 8 | polyfills-es5.405730e5ac8f727bd7d7.js,1568465090444,fc4f710b3195578c912aa6c287560507e7dd1ca1313cb3c62901a7251237ca8e 9 | main-es2015.48d5fba79453bf395395.js,1568465112723,4d344e27fc53b6633a2b1890bdb00e8850ecf4a1d93c73655bcba2d04e13ae9c 10 | main-es5.ba775f071932b1e35133.js,1568465090443,0a6fc4b1d90e4b7a70851fd1224ab71d7fa20d2a8970762d0a769d8c65c7702e 11 | -------------------------------------------------------------------------------- /.firebaserc: -------------------------------------------------------------------------------- 1 | { 2 | "projects": { 3 | "default": "mokuton-15add" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | # Only exists if Bazel was run 8 | /bazel-out 9 | 10 | # dependencies 11 | /node_modules 12 | 13 | # profiling files 14 | chrome-profiler-events.json 15 | speed-measure-plugin.json 16 | 17 | # IDEs and editors 18 | /.idea 19 | .project 20 | .classpath 21 | .c9/ 22 | *.launch 23 | .settings/ 24 | *.sublime-workspace 25 | 26 | # IDE - VSCode 27 | .vscode/* 28 | !.vscode/settings.json 29 | !.vscode/tasks.json 30 | !.vscode/launch.json 31 | !.vscode/extensions.json 32 | .history/* 33 | 34 | # misc 35 | /.sass-cache 36 | /connect.lock 37 | /coverage 38 | /libpeerconnection.log 39 | npm-debug.log 40 | yarn-error.log 41 | testem.log 42 | /typings 43 | 44 | # System Files 45 | .DS_Store 46 | Thumbs.db 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CountdownRxjs 2 | 3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.0.1. 4 | 5 | ## Development server 6 | 7 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. 8 | 9 | *Important*: Must have Angular CLI and NodeJS installed 10 | 11 | ### To work on the follow-along branch: 12 | - In your terminal/command-line 13 | ``` 14 | git clone https://github.com/Everduin94/countdown-rxjs.git 15 | cd countdown-rxjs 16 | npm install 17 | git checkout follow-along 18 | ``` 19 | -------------------------------------------------------------------------------- /angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "countdown-rxjs": { 7 | "projectType": "application", 8 | "schematics": {}, 9 | "root": "", 10 | "sourceRoot": "src", 11 | "prefix": "app", 12 | "architect": { 13 | "build": { 14 | "builder": "@angular-devkit/build-angular:browser", 15 | "options": { 16 | "outputPath": "dist/countdown-rxjs", 17 | "index": "src/index.html", 18 | "main": "src/main.ts", 19 | "polyfills": "src/polyfills.ts", 20 | "tsConfig": "tsconfig.app.json", 21 | "assets": [ 22 | "src/favicon.ico", 23 | "src/assets" 24 | ], 25 | "styles": [ 26 | "src/styles.css" 27 | ], 28 | "scripts": [] 29 | }, 30 | "configurations": { 31 | "production": { 32 | "fileReplacements": [ 33 | { 34 | "replace": "src/environments/environment.ts", 35 | "with": "src/environments/environment.prod.ts" 36 | } 37 | ], 38 | "optimization": true, 39 | "outputHashing": "all", 40 | "sourceMap": false, 41 | "extractCss": true, 42 | "namedChunks": false, 43 | "aot": true, 44 | "extractLicenses": true, 45 | "vendorChunk": false, 46 | "buildOptimizer": true, 47 | "budgets": [ 48 | { 49 | "type": "initial", 50 | "maximumWarning": "2mb", 51 | "maximumError": "5mb" 52 | } 53 | ] 54 | } 55 | } 56 | }, 57 | "serve": { 58 | "builder": "@angular-devkit/build-angular:dev-server", 59 | "options": { 60 | "browserTarget": "countdown-rxjs:build" 61 | }, 62 | "configurations": { 63 | "production": { 64 | "browserTarget": "countdown-rxjs:build:production" 65 | } 66 | } 67 | }, 68 | "extract-i18n": { 69 | "builder": "@angular-devkit/build-angular:extract-i18n", 70 | "options": { 71 | "browserTarget": "countdown-rxjs:build" 72 | } 73 | }, 74 | "test": { 75 | "builder": "@angular-devkit/build-angular:karma", 76 | "options": { 77 | "main": "src/test.ts", 78 | "polyfills": "src/polyfills.ts", 79 | "tsConfig": "tsconfig.spec.json", 80 | "karmaConfig": "karma.conf.js", 81 | "assets": [ 82 | "src/favicon.ico", 83 | "src/assets" 84 | ], 85 | "styles": [ 86 | "src/styles.css" 87 | ], 88 | "scripts": [] 89 | } 90 | }, 91 | "lint": { 92 | "builder": "@angular-devkit/build-angular:tslint", 93 | "options": { 94 | "tsConfig": [ 95 | "tsconfig.app.json", 96 | "tsconfig.spec.json", 97 | "e2e/tsconfig.json" 98 | ], 99 | "exclude": [ 100 | "**/node_modules/**" 101 | ] 102 | } 103 | }, 104 | "e2e": { 105 | "builder": "@angular-devkit/build-angular:protractor", 106 | "options": { 107 | "protractorConfig": "e2e/protractor.conf.js", 108 | "devServerTarget": "countdown-rxjs:serve" 109 | }, 110 | "configurations": { 111 | "production": { 112 | "devServerTarget": "countdown-rxjs:serve:production" 113 | } 114 | } 115 | } 116 | } 117 | }}, 118 | "defaultProject": "countdown-rxjs" 119 | } -------------------------------------------------------------------------------- /browserslist: -------------------------------------------------------------------------------- 1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below. 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | 5 | # You can see what browsers were selected by your queries by running: 6 | # npx browserslist 7 | 8 | > 0.5% 9 | last 2 versions 10 | Firefox ESR 11 | not dead 12 | not IE 9-11 # For IE 9-11 support, remove 'not'. -------------------------------------------------------------------------------- /e2e/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | // Protractor configuration file, see link for more information 3 | // https://github.com/angular/protractor/blob/master/lib/config.ts 4 | 5 | const { SpecReporter } = require('jasmine-spec-reporter'); 6 | 7 | /** 8 | * @type { import("protractor").Config } 9 | */ 10 | exports.config = { 11 | allScriptsTimeout: 11000, 12 | specs: [ 13 | './src/**/*.e2e-spec.ts' 14 | ], 15 | capabilities: { 16 | 'browserName': 'chrome' 17 | }, 18 | directConnect: true, 19 | baseUrl: 'http://localhost:4200/', 20 | framework: 'jasmine', 21 | jasmineNodeOpts: { 22 | showColors: true, 23 | defaultTimeoutInterval: 30000, 24 | print: function() {} 25 | }, 26 | onPrepare() { 27 | require('ts-node').register({ 28 | project: require('path').join(__dirname, './tsconfig.json') 29 | }); 30 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); 31 | } 32 | }; -------------------------------------------------------------------------------- /e2e/src/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | import { browser, logging } from 'protractor'; 3 | 4 | describe('workspace-project App', () => { 5 | let page: AppPage; 6 | 7 | beforeEach(() => { 8 | page = new AppPage(); 9 | }); 10 | 11 | it('should display welcome message', () => { 12 | page.navigateTo(); 13 | expect(page.getTitleText()).toEqual('Welcome to countdown-rxjs!'); 14 | }); 15 | 16 | afterEach(async () => { 17 | // Assert that there are no errors emitted from the browser 18 | const logs = await browser.manage().logs().get(logging.Type.BROWSER); 19 | expect(logs).not.toContain(jasmine.objectContaining({ 20 | level: logging.Level.SEVERE, 21 | } as logging.Entry)); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /e2e/src/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo() { 5 | return browser.get(browser.baseUrl) as Promise; 6 | } 7 | 8 | getTitleText() { 9 | return element(by.css('app-root h1')).getText() as Promise; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /e2e/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/e2e", 5 | "module": "commonjs", 6 | "target": "es5", 7 | "types": [ 8 | "jasmine", 9 | "jasminewd2", 10 | "node" 11 | ] 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "hosting": { 3 | "public": "dist/countdown-rxjs", 4 | "ignore": [ 5 | "firebase.json", 6 | "**/.*", 7 | "**/node_modules/**" 8 | ] 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | dir: require('path').join(__dirname, './coverage/countdown-rxjs'), 20 | reports: ['html', 'lcovonly', 'text-summary'], 21 | fixWebpackSourcePaths: true 22 | }, 23 | reporters: ['progress', 'kjhtml'], 24 | port: 9876, 25 | colors: true, 26 | logLevel: config.LOG_INFO, 27 | autoWatch: true, 28 | browsers: ['Chrome'], 29 | singleRun: false, 30 | restartOnFileChange: true 31 | }); 32 | }; 33 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "countdown-rxjs", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "ng": "ng", 6 | "start": "ng serve", 7 | "build": "ng build", 8 | "test": "ng test", 9 | "lint": "ng lint", 10 | "e2e": "ng e2e" 11 | }, 12 | "private": true, 13 | "dependencies": { 14 | "@angular/animations": "~8.0.0", 15 | "@angular/common": "~8.0.0", 16 | "@angular/compiler": "~8.0.0", 17 | "@angular/core": "~8.0.0", 18 | "@angular/forms": "~8.0.0", 19 | "@angular/platform-browser": "~8.0.0", 20 | "@angular/platform-browser-dynamic": "~8.0.0", 21 | "@angular/router": "~8.0.0", 22 | "@fortawesome/angular-fontawesome": "^0.4.0", 23 | "@fortawesome/fontawesome-svg-core": "^1.2.19", 24 | "@fortawesome/free-solid-svg-icons": "^5.9.0", 25 | "contentful": "^7.10.0", 26 | "querystringify": "^2.1.1", 27 | "rxjs": "~6.4.0", 28 | "tslib": "^1.9.0", 29 | "zone.js": "~0.9.1" 30 | }, 31 | "devDependencies": { 32 | "@angular-devkit/build-angular": "~0.800.0", 33 | "@angular/cli": "~8.0.1", 34 | "@angular/compiler-cli": "~8.0.0", 35 | "@angular/language-service": "~8.0.0", 36 | "@types/node": "~8.9.4", 37 | "@types/jasmine": "~3.3.8", 38 | "@types/jasminewd2": "~2.0.3", 39 | "codelyzer": "^5.0.0", 40 | "jasmine-core": "~3.4.0", 41 | "jasmine-spec-reporter": "~4.2.1", 42 | "karma": "~4.1.0", 43 | "karma-chrome-launcher": "~2.2.0", 44 | "karma-coverage-istanbul-reporter": "~2.0.1", 45 | "karma-jasmine": "~2.0.1", 46 | "karma-jasmine-html-reporter": "^1.4.0", 47 | "protractor": "~5.4.0", 48 | "ts-node": "~7.0.0", 49 | "tslint": "~5.15.0", 50 | "typescript": "~3.4.3" 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/app/app.component.css: -------------------------------------------------------------------------------- 1 | .center { 2 | padding: 20px; 3 | position: fixed; 4 | width: 600px; 5 | top: 50%; 6 | left: 50%; 7 | transform: translate(-50%, -50%); 8 | border-radius: 2px; 9 | box-shadow: 0 0 5px rgba(0,0,0,0.3); 10 | text-align: center; 11 | z-index: 1; 12 | background: #2a2e35; 13 | } 14 | 15 | .background { 16 | position: fixed; 17 | height: 100%; 18 | width: 100%; 19 | left: 0; 20 | top: 0; 21 | z-index: -10; 22 | background: rgb(89,45,137); 23 | background: linear-gradient(135deg, rgba(89,45,137,1) 0%, rgba(42,46,53,1) 35%, rgba(42,46,53,1) 50%, rgba(42,46,53,1) 65%, rgba(236,12,142,1) 100%); 24 | } -------------------------------------------------------------------------------- /src/app/app.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 | 5 |
6 |
7 | -------------------------------------------------------------------------------- /src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, async } from '@angular/core/testing'; 2 | import { AppComponent } from './app.component'; 3 | 4 | describe('AppComponent', () => { 5 | beforeEach(async(() => { 6 | TestBed.configureTestingModule({ 7 | declarations: [ 8 | AppComponent 9 | ], 10 | }).compileComponents(); 11 | })); 12 | 13 | it('should create the app', () => { 14 | const fixture = TestBed.createComponent(AppComponent); 15 | const app = fixture.debugElement.componentInstance; 16 | expect(app).toBeTruthy(); 17 | }); 18 | 19 | it(`should have as title 'countdown-rxjs'`, () => { 20 | const fixture = TestBed.createComponent(AppComponent); 21 | const app = fixture.debugElement.componentInstance; 22 | expect(app.title).toEqual('countdown-rxjs'); 23 | }); 24 | 25 | it('should render title in a h1 tag', () => { 26 | const fixture = TestBed.createComponent(AppComponent); 27 | fixture.detectChanges(); 28 | const compiled = fixture.debugElement.nativeElement; 29 | expect(compiled.querySelector('h1').textContent).toContain('Welcome to countdown-rxjs!'); 30 | }); 31 | }); 32 | -------------------------------------------------------------------------------- /src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-root', 5 | templateUrl: './app.component.html', 6 | styleUrls: ['./app.component.css'] 7 | }) 8 | export class AppComponent { 9 | title = 'countdown-rxjs'; 10 | } 11 | -------------------------------------------------------------------------------- /src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { BrowserModule } from '@angular/platform-browser'; 2 | import { NgModule } from '@angular/core'; 3 | 4 | import { AppComponent } from './app.component'; 5 | import { TimeInputComponent } from './components/time-input/time-input.component'; 6 | import { CountdownComponent } from './components/countdown/countdown.component'; 7 | import { InputToCountdownDirective } from './directives/input-to-countdown.directive'; 8 | import { TimeFormatPipe } from './pipes/time-format.pipe'; 9 | import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; 10 | 11 | @NgModule({ 12 | declarations: [ 13 | AppComponent, 14 | TimeInputComponent, 15 | CountdownComponent, 16 | InputToCountdownDirective, 17 | TimeFormatPipe 18 | ], 19 | imports: [ 20 | BrowserModule, 21 | FontAwesomeModule 22 | ], 23 | providers: [], 24 | bootstrap: [AppComponent] 25 | }) 26 | export class AppModule { } 27 | -------------------------------------------------------------------------------- /src/app/components/countdown/countdown.component.css: -------------------------------------------------------------------------------- 1 | button { 2 | padding: 20px; 3 | border-radius: 24px; 4 | background: #FFFFFF; 5 | margin: 15px; 6 | box-shadow: 0 0 5px rgba(0,0,0,0.3); 7 | border: 1px solid #FFFFFF; 8 | 9 | } 10 | 11 | ng-container { 12 | font-size: 48px; 13 | } 14 | 15 | 16 | :host { 17 | font-size: 128px; 18 | color: #FFFFFF; 19 | } 20 | 21 | .description { 22 | font-size: 24px; 23 | } -------------------------------------------------------------------------------- /src/app/components/countdown/countdown.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | {{clock | timeFormat}} 4 | 5 | 00:00:00 6 | 7 | 8 |
9 | 10 | 11 | 12 |
13 | 14 |
15 | {{selectedDrill.description}} 16 |
17 | 18 |
19 | 22 |
23 | 24 | -------------------------------------------------------------------------------- /src/app/components/countdown/countdown.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { CountdownComponent } from './countdown.component'; 4 | 5 | describe('CountdownComponent', () => { 6 | let component: CountdownComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ CountdownComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(CountdownComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/countdown/countdown.component.ts: -------------------------------------------------------------------------------- 1 | import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core'; 2 | import { fromEvent, interval, merge, of, range, BehaviorSubject, Subject } from 'rxjs'; 3 | import { mapTo, scan, switchMap, takeUntil, concatMap, delay, mergeMap, tap, skipWhile, map } from 'rxjs/operators'; 4 | import { faPlay } from '@fortawesome/free-solid-svg-icons'; 5 | import { faPause } from '@fortawesome/free-solid-svg-icons'; 6 | import { faSquare } from '@fortawesome/free-solid-svg-icons'; 7 | import { InputToCountdownDirective } from 'src/app/directives/input-to-countdown.directive'; 8 | import { SynthesisService } from 'src/app/services/synthesis.service'; 9 | import { ContentfulService } from 'src/app/services/contentful.service'; 10 | 11 | @Component({ 12 | selector: 'app-countdown', 13 | templateUrl: './countdown.component.html', 14 | styleUrls: ['./countdown.component.css'] 15 | }) 16 | export class CountdownComponent implements OnInit, AfterViewInit { 17 | 18 | faPlay = faPlay; 19 | faPause = faPause; 20 | faSquare = faSquare; 21 | 22 | @ViewChild('start', { static: true }) 23 | startBtn: ElementRef; 24 | 25 | @ViewChild('pause', { static: true }) 26 | pauseBtn: ElementRef; 27 | 28 | @ViewChild('reset', { static: true }) 29 | resetBtn: ElementRef; 30 | 31 | @ViewChild('drillSelect', { static: true }) 32 | drillSelect: ElementRef; 33 | 34 | drills$; 35 | techniques = []; 36 | selectedDrill$ = new Subject(); 37 | selectedDrillObs$; 38 | 39 | intervalObs$; 40 | max = 0; 41 | min = 0; 42 | 43 | constructor(public d: InputToCountdownDirective, private s: SynthesisService, private c: ContentfulService) { } 44 | 45 | ngOnInit() { 46 | this.drills$ = this.c.getDrills().pipe(tap(val => this.selectedDrill$.next(val[0]))); 47 | this.selectedDrillObs$ = this.selectedDrill$.asObservable().pipe(map(val => { 48 | const drill = this.c.getSelectedDrill(val); 49 | this.techniques = drill.techniques; 50 | return drill; 51 | })) 52 | } 53 | 54 | ngAfterViewInit(): void { 55 | // 3.1 56 | this.s.updateMessage('hello'); 57 | const start$ = fromEvent(this.startBtn.nativeElement, 'click').pipe(mapTo(true)); 58 | const pause$ = fromEvent(this.pauseBtn.nativeElement, 'click').pipe(mapTo(false)); 59 | const reset$ = fromEvent(this.resetBtn.nativeElement, 'click').pipe(mapTo(null)); 60 | const zero$ = new Subject(); 61 | const stateChange$ = this.d.obs$.pipe(mapTo(null)); 62 | this.intervalObs$ = merge(start$, pause$, reset$, stateChange$, zero$).pipe( 63 | switchMap(isCounting => { 64 | if (isCounting === null) return of(null); 65 | return isCounting ? interval(1000) : of(); 66 | }), 67 | scan((accumulatedValue, currentValue) => { 68 | if (accumulatedValue === 0 && currentValue !== null) { 69 | zero$.next(null); 70 | return accumulatedValue; 71 | } 72 | if (currentValue === null || !accumulatedValue) return this.d.getTotalSeconds(); 73 | return --accumulatedValue; 74 | }) 75 | ); 76 | // End 3.1 77 | 78 | this.d.intervalObs$.subscribe(val => { 79 | console.log(val) 80 | this.max = val.max; 81 | this.min = val.min; 82 | }); // TODO: Don't do this, Brain is alseep. 83 | 84 | 85 | merge(start$, pause$, reset$, zero$).pipe( 86 | switchMap(isCounting => { 87 | const random = () => { 88 | console.log(this.min); 89 | console.log(this.max); 90 | 91 | const value = (this.min * 1000) + (Math.floor((Math.random() * (this.max + 1 - this.min))) * 1000) 92 | console.log(value); 93 | return value; 94 | }; 95 | if (isCounting === null) return of(null); 96 | return isCounting ? interval(1000).pipe( 97 | concatMap(val => { 98 | return of(val).pipe(delay(random()), tap(val => { 99 | const arrayLength = this.techniques.length; 100 | const randValue = Math.floor((Math.random() * arrayLength)) 101 | const message = this.techniques[randValue]; 102 | this.s.updateMessage(message); 103 | this.s.speak(); 104 | })); 105 | }) 106 | ) : of(); 107 | }), 108 | ).subscribe(console.log) // TODO: Don't do this either, async pipe later or something cute 109 | } 110 | 111 | drillChanged(value) { 112 | this.selectedDrill$.next(value); 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /src/app/components/time-input/time-input.component.css: -------------------------------------------------------------------------------- 1 | :host { 2 | display: block; 3 | } 4 | 5 | input { 6 | display: inline-block; 7 | width: 6em; 8 | padding-left: 10px; 9 | position: relative; 10 | top: -3em; 11 | background: #454e56; 12 | color: #FFFFFF; 13 | border: none; 14 | font-size: 18px; 15 | } 16 | 17 | label { 18 | display: inline-block; 19 | width: 6em; 20 | margin-right: 1.5em; 21 | padding-top: 3em; 22 | text-align: center; 23 | color: #FFFFFF; 24 | } 25 | -------------------------------------------------------------------------------- /src/app/components/time-input/time-input.component.html: -------------------------------------------------------------------------------- 1 | 2 | 8 | 14 | 20 | 21 |
22 | 28 | 29 | 35 | -------------------------------------------------------------------------------- /src/app/components/time-input/time-input.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { TimeInputComponent } from './time-input.component'; 4 | 5 | describe('TimeInputComponent', () => { 6 | let component: TimeInputComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ TimeInputComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(TimeInputComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/time-input/time-input.component.ts: -------------------------------------------------------------------------------- 1 | import {Component, OnInit} from '@angular/core'; 2 | import { InputToCountdownDirective } from 'src/app/directives/input-to-countdown.directive'; 3 | 4 | @Component({ 5 | selector: 'app-time-input', 6 | templateUrl: './time-input.component.html', 7 | styleUrls: ['./time-input.component.css'] 8 | }) 9 | export class TimeInputComponent implements OnInit { 10 | 11 | constructor(public d: InputToCountdownDirective) {} 12 | 13 | ngOnInit() {} 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/app/directives/input-to-countdown.directive.spec.ts: -------------------------------------------------------------------------------- 1 | import { InputToCountdownDirective } from './input-to-countdown.directive'; 2 | 3 | describe('InputToCountdownDirective', () => { 4 | it('should create an instance', () => { 5 | const directive = new InputToCountdownDirective(); 6 | expect(directive).toBeTruthy(); 7 | }); 8 | }); 9 | -------------------------------------------------------------------------------- /src/app/directives/input-to-countdown.directive.ts: -------------------------------------------------------------------------------- 1 | import { Directive } from '@angular/core'; 2 | import {BehaviorSubject} from 'rxjs'; 3 | 4 | @Directive({ 5 | selector: '[appInputToCountdown]' 6 | }) 7 | export class InputToCountdownDirective { 8 | 9 | // 1.1 10 | private state = new BehaviorSubject({ 11 | seconds: 0, 12 | minutes: 0, 13 | hours: 0, 14 | totalTime: 0 15 | }); 16 | public obs$ = this.state.asObservable(); 17 | // End 1.1 18 | 19 | private intervalState = new BehaviorSubject({ 20 | min: 0, 21 | max: 0 22 | }); 23 | public intervalObs$ = this.intervalState.asObservable(); 24 | 25 | // 1.2 26 | updateState(value, command) { 27 | let valToNumber = parseInt(value); 28 | if (valToNumber < 0) valToNumber = 0; 29 | let update = this.state.value; 30 | if (command === 'seconds') update.seconds = valToNumber; 31 | if (command === 'minutes') update.minutes = valToNumber; 32 | if (command === 'hours') update.hours = valToNumber; 33 | update.totalTime = this.calculateSeconds(update); 34 | this.state.next(update); 35 | } 36 | // End 1.2 37 | 38 | updateIntervalState(value, command) { 39 | let valToNumber = parseInt(value); 40 | if (valToNumber < 0) valToNumber = 0; 41 | let update = this.intervalState.value; 42 | if (command === 'min') update.min = valToNumber; 43 | if (command === 'max') update.max = valToNumber; 44 | this.intervalState.next(update); 45 | } 46 | 47 | // 1.3 48 | calculateSeconds(update) { 49 | let totalTime = update.seconds 50 | totalTime += update.minutes * 60; 51 | totalTime += (update.hours * 60) * 60; 52 | return totalTime; 53 | } 54 | // End 1.3 55 | 56 | constructor() {} 57 | 58 | getSeconds() { 59 | return this.state.value.seconds; 60 | } 61 | 62 | getMinutes() { 63 | return this.state.value.minutes; 64 | } 65 | 66 | getHours() { 67 | return this.state.value.hours; 68 | } 69 | 70 | getTotalSeconds() { 71 | return this.state.value.totalTime; 72 | } 73 | 74 | 75 | getMin() { 76 | return this.intervalState.value.min; 77 | } 78 | 79 | getMax() { 80 | return this.intervalState.value.max; 81 | } 82 | 83 | } 84 | -------------------------------------------------------------------------------- /src/app/pipes/time-format.pipe.spec.ts: -------------------------------------------------------------------------------- 1 | import { TimeFormatPipe } from './time-format.pipe'; 2 | 3 | describe('TimeFormatPipe', () => { 4 | it('create an instance', () => { 5 | const pipe = new TimeFormatPipe(); 6 | expect(pipe).toBeTruthy(); 7 | }); 8 | }); 9 | -------------------------------------------------------------------------------- /src/app/pipes/time-format.pipe.ts: -------------------------------------------------------------------------------- 1 | import { Pipe, PipeTransform } from '@angular/core'; 2 | 3 | @Pipe({ 4 | name: 'timeFormat', 5 | pure: true 6 | }) 7 | export class TimeFormatPipe implements PipeTransform { 8 | 9 | /** 10 | * Value is in seconds. 11 | */ 12 | transform(value: any, args?: any): any { 13 | // 4.1 14 | const hours = Math.floor((value / 60) / 60); 15 | const minutes = Math.floor(value / 60) % 60; 16 | const seconds = value % 60; 17 | return `${this.padding(hours)}${hours}:${this.padding(minutes)}${minutes}:${this.padding(seconds)}${seconds}`; 18 | // END 4.1 19 | } 20 | 21 | private padding(time) { 22 | return time < 10 ? '0' : ''; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/app/services/contentful.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { ContentfulService } from './contentful.service'; 4 | 5 | describe('ContentfulService', () => { 6 | beforeEach(() => TestBed.configureTestingModule({})); 7 | 8 | it('should be created', () => { 9 | const service: ContentfulService = TestBed.get(ContentfulService); 10 | expect(service).toBeTruthy(); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /src/app/services/contentful.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | 3 | import { createClient, Entry } from 'contentful'; 4 | import { from, Observable } from 'rxjs'; 5 | import { map, tap } from 'rxjs/operators'; 6 | 7 | // https://www.contentful.com/developers/docs/references/authentication/ 8 | const CONFIG = { 9 | space: 'cxts8zfs2vii', 10 | accessToken: 'h2qV-rw0CG7F4XZdDDA9zK0XTqQKUwZfKnrQOktuYXI', 11 | 12 | contentTypeIds: { 13 | drills: 'drills', 14 | } 15 | } 16 | 17 | @Injectable({ 18 | providedIn: 'root' 19 | }) 20 | export class ContentfulService { 21 | 22 | public content; 23 | 24 | private cdaClient = createClient({ 25 | space: CONFIG.space, 26 | accessToken: CONFIG.accessToken 27 | }); 28 | 29 | constructor() { 30 | this.getContentFromServer().subscribe(val => { 31 | this.content = val; 32 | }) 33 | } 34 | 35 | getSelectedDrill(name) { 36 | if (!this.content) return {}; 37 | 38 | const item = this.content 39 | .filter(val => val.fields['name'] === name) 40 | .map(val => ({ 41 | id: val.fields['id'], 42 | name: val.fields['name'], 43 | description: val.fields['description'], 44 | techniques: val.fields['techniques'] 45 | }))[0]; 46 | return item; 47 | } 48 | 49 | 50 | getContentFromServer() { 51 | const promise = this.cdaClient.getEntries({ content_type: CONFIG.contentTypeIds.drills }) 52 | return from(promise).pipe(map(val => { 53 | return val.items; 54 | })); 55 | } 56 | 57 | getDrills() { 58 | const promise = this.cdaClient.getEntries({ content_type: CONFIG.contentTypeIds.drills }) 59 | return from(promise).pipe(map(val => val.items.map(val => val.fields['name'])), tap(console.log)); 60 | } 61 | 62 | // ud = CONFIG.contentTypeIds.product 63 | getEntries(id, query?: object): Observable[]> { 64 | // TODO: Double check this, because I updated to ES6 Spread 65 | return from(this.cdaClient.getEntries({ ...query, content_type: id })).pipe(map(entries => entries.items)); 66 | } 67 | 68 | getEntry(id): Observable { 69 | const promise = this.cdaClient.getEntry(id); 70 | return from(promise).pipe(map(entry => entry.fields)); 71 | } 72 | } -------------------------------------------------------------------------------- /src/app/services/synthesis.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { SynthesisService } from './synthesis.service'; 4 | 5 | describe('SynthesisService', () => { 6 | beforeEach(() => TestBed.configureTestingModule({})); 7 | 8 | it('should be created', () => { 9 | const service: SynthesisService = TestBed.get(SynthesisService); 10 | expect(service).toBeTruthy(); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /src/app/services/synthesis.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { BehaviorSubject } from 'rxjs'; 3 | import { tap } from 'rxjs/operators'; 4 | 5 | declare let window: Window; 6 | 7 | @Injectable({ 8 | providedIn: 'root' 9 | }) 10 | export class SynthesisService { 11 | 12 | private message = new BehaviorSubject(''); 13 | public obs$ = this.message.asObservable().pipe(tap(val => { 14 | this.utterance.text = val 15 | })); 16 | synth = window.speechSynthesis; 17 | utterance = new SpeechSynthesisUtterance(); 18 | 19 | constructor() { 20 | this.utterance.voice = this.synth.getVoices()[0]; 21 | this.obs$.subscribe(); // TODO: Remove 22 | } 23 | 24 | speak() { 25 | this.synth.speak(this.utterance); 26 | } 27 | 28 | updateMessage(msg) { 29 | this.message.next(msg); 30 | } 31 | } -------------------------------------------------------------------------------- /src/app/snippets.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 |
5 | 6 | 7 | private state = new BehaviorSubject({ 8 | seconds: 0, 9 | minutes: 0, 10 | hours: 0, 11 | totalTime: 0 12 | }); 13 | obs$ = this.state.asObservable(); 14 | 15 | updateState(value, command) { 16 | let valToNumber = parseInt(value); 17 | if (valToNumber > 59 || valToNumber < 0) valToNumber = 0; 18 | let update = {...this.state.value}; 19 | if (command === 'seconds') update.seconds = valToNumber; 20 | if (command === 'minutes') update.minutes = valToNumber; 21 | if (command === 'hours') update.hours = valToNumber; 22 | update.totalTime = this.calculateSeconds(update); 23 | this.state.next(update); 24 | } 25 | 26 | calculateSeconds(state) { 27 | const time = state; 28 | let totalTime = time.seconds 29 | totalTime += time.minutes * 60; 30 | totalTime += (time.hours * 60) * 60; 31 | return totalTime; 32 | } -------------------------------------------------------------------------------- /src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Everduin94/countdown-rxjs/1c6cbd64a83e120800d80e5cfde87e0e6f464eb0/src/assets/.gitkeep -------------------------------------------------------------------------------- /src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // This file can be replaced during build by using the `fileReplacements` array. 2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. 3 | // The list of file replacements can be found in `angular.json`. 4 | 5 | export const environment = { 6 | production: false 7 | }; 8 | 9 | /* 10 | * For easier debugging in development mode, you can import the following file 11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. 12 | * 13 | * This import should be commented out in production mode because it will have a negative impact 14 | * on performance if an error is thrown. 15 | */ 16 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI. 17 | -------------------------------------------------------------------------------- /src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Everduin94/countdown-rxjs/1c6cbd64a83e120800d80e5cfde87e0e6f464eb0/src/favicon.ico -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CountdownRxjs 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.error(err)); 13 | -------------------------------------------------------------------------------- /src/polyfills.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file includes polyfills needed by Angular and is loaded before the app. 3 | * You can add your own extra polyfills to this file. 4 | * 5 | * This file is divided into 2 sections: 6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. 7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main 8 | * file. 9 | * 10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that 11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), 12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. 13 | * 14 | * Learn more in https://angular.io/guide/browser-support 15 | */ 16 | 17 | /*************************************************************************************************** 18 | * BROWSER POLYFILLS 19 | */ 20 | 21 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */ 22 | // import 'classlist.js'; // Run `npm install --save classlist.js`. 23 | 24 | /** 25 | * Web Animations `@angular/platform-browser/animations` 26 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. 27 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). 28 | */ 29 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`. 30 | 31 | /** 32 | * By default, zone.js will patch all possible macroTask and DomEvents 33 | * user can disable parts of macroTask/DomEvents patch by setting following flags 34 | * because those flags need to be set before `zone.js` being loaded, and webpack 35 | * will put import in the top of bundle, so user need to create a separate file 36 | * in this directory (for example: zone-flags.ts), and put the following flags 37 | * into that file, and then add the following code before importing zone.js. 38 | * import './zone-flags.ts'; 39 | * 40 | * The flags allowed in zone-flags.ts are listed here. 41 | * 42 | * The following flags will work for all browsers. 43 | * 44 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame 45 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick 46 | * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames 47 | * 48 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js 49 | * with the following flag, it will bypass `zone.js` patch for IE/Edge 50 | * 51 | * (window as any).__Zone_enable_cross_context_check = true; 52 | * 53 | */ 54 | 55 | /*************************************************************************************************** 56 | * Zone JS is required by default for Angular itself. 57 | */ 58 | import 'zone.js/dist/zone'; // Included with Angular CLI. 59 | 60 | 61 | /*************************************************************************************************** 62 | * APPLICATION IMPORTS 63 | */ 64 | -------------------------------------------------------------------------------- /src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | /* #b7178c */ 3 | @keyframes colorhue{ 4 | from {-webkit-filter: hue-rotate(0deg); filter: hue-rotate(0deg);} 5 | to {-webkit-filter: hue-rotate(359deg); filter: hue-rotate(359deg);} 6 | } 7 | 8 | .edit { 9 | animation: colorhue 10s linear infinite; 10 | } 11 | -------------------------------------------------------------------------------- /src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/zone-testing'; 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting 8 | } from '@angular/platform-browser-dynamic/testing'; 9 | 10 | declare const require: any; 11 | 12 | // First, initialize the Angular testing environment. 13 | getTestBed().initTestEnvironment( 14 | BrowserDynamicTestingModule, 15 | platformBrowserDynamicTesting() 16 | ); 17 | // Then we find all the tests. 18 | const context = require.context('./', true, /\.spec\.ts$/); 19 | // And load the modules. 20 | context.keys().map(context); 21 | -------------------------------------------------------------------------------- /tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./out-tsc/app", 5 | "types": [] 6 | }, 7 | "include": [ 8 | "src/**/*.ts" 9 | ], 10 | "exclude": [ 11 | "src/test.ts", 12 | "src/**/*.spec.ts" 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "baseUrl": "./", 5 | "outDir": "./dist/out-tsc", 6 | "sourceMap": true, 7 | "declaration": false, 8 | "module": "esnext", 9 | "moduleResolution": "node", 10 | "emitDecoratorMetadata": true, 11 | "experimentalDecorators": true, 12 | "importHelpers": true, 13 | "target": "es2015", 14 | "typeRoots": [ 15 | "node_modules/@types" 16 | ], 17 | "lib": [ 18 | "es2018", 19 | "dom" 20 | ] 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./out-tsc/spec", 5 | "types": [ 6 | "jasmine", 7 | "node" 8 | ] 9 | }, 10 | "files": [ 11 | "src/test.ts", 12 | "src/polyfills.ts" 13 | ], 14 | "include": [ 15 | "src/**/*.spec.ts", 16 | "src/**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "tslint:recommended", 3 | "rules": { 4 | "array-type": false, 5 | "arrow-parens": false, 6 | "deprecation": { 7 | "severity": "warn" 8 | }, 9 | "component-class-suffix": true, 10 | "contextual-lifecycle": true, 11 | "directive-class-suffix": true, 12 | "directive-selector": [ 13 | true, 14 | "attribute", 15 | "app", 16 | "camelCase" 17 | ], 18 | "component-selector": [ 19 | true, 20 | "element", 21 | "app", 22 | "kebab-case" 23 | ], 24 | "import-blacklist": [ 25 | true, 26 | "rxjs/Rx" 27 | ], 28 | "interface-name": false, 29 | "max-classes-per-file": false, 30 | "max-line-length": [ 31 | true, 32 | 140 33 | ], 34 | "member-access": false, 35 | "member-ordering": [ 36 | true, 37 | { 38 | "order": [ 39 | "static-field", 40 | "instance-field", 41 | "static-method", 42 | "instance-method" 43 | ] 44 | } 45 | ], 46 | "no-consecutive-blank-lines": false, 47 | "no-console": [ 48 | true, 49 | "debug", 50 | "info", 51 | "time", 52 | "timeEnd", 53 | "trace" 54 | ], 55 | "no-empty": false, 56 | "no-inferrable-types": [ 57 | true, 58 | "ignore-params" 59 | ], 60 | "no-non-null-assertion": true, 61 | "no-redundant-jsdoc": true, 62 | "no-switch-case-fall-through": true, 63 | "no-use-before-declare": true, 64 | "no-var-requires": false, 65 | "object-literal-key-quotes": [ 66 | true, 67 | "as-needed" 68 | ], 69 | "object-literal-sort-keys": false, 70 | "ordered-imports": false, 71 | "quotemark": [ 72 | true, 73 | "single" 74 | ], 75 | "trailing-comma": false, 76 | "no-conflicting-lifecycle": true, 77 | "no-host-metadata-property": true, 78 | "no-input-rename": true, 79 | "no-inputs-metadata-property": true, 80 | "no-output-native": true, 81 | "no-output-on-prefix": true, 82 | "no-output-rename": true, 83 | "no-outputs-metadata-property": true, 84 | "template-banana-in-box": true, 85 | "template-no-negated-async": true, 86 | "use-lifecycle-interface": true, 87 | "use-pipe-transform-interface": true 88 | }, 89 | "rulesDirectory": [ 90 | "codelyzer" 91 | ] 92 | } --------------------------------------------------------------------------------