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 * as ts from 'typescript'; | |
let options = { | |
stripInternal: true, | |
target: ts.ScriptTarget.ES5, | |
experimentalDecorators: true, | |
listEmittedFiles: true | |
}; | |
function transform(ctx: ts.TransformationContext): ts.Transformer<ts.SourceFile> { |
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 EventEmitter = require('events').EventEmitter; | |
global.customEmitter = new EventEmitter(); | |
let evtCount = 0; | |
module.exports = function someFunction() { | |
global.customEmitter.addListener('foo', somePrivateFunction); | |
} | |
function somePrivateFunction() { | |
evtCount++; |
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 someFunction = require('./index'); | |
const rewire = require('rewire'); | |
let app; | |
beforeEach(() => { | |
someFunction(); | |
app = rewire('./index.js'); | |
}); | |
test('it should increment evtCount', () => { |
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 someFunction = require('./index'); | |
const rewire = require('rewire'); | |
let app; | |
beforeEach(() => { | |
someFunction(); | |
app = rewire('./index.js'); | |
}); | |
test('it should increment evtCount', () => { |
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 { Injectable } from '@angular/core'; | |
import {BehaviorSubject} from 'rxjs'; | |
@Injectable({ | |
providedIn: 'root' | |
}) | |
export class LoadingService { | |
loadingSub: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false); | |
/** | |
* Contains in-progress loading requests |
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
<!-- Loading spinner --> | |
<div *ngIf="loading" class="loading-container flex-content-center"> | |
<mat-progress-spinner | |
color="primary" | |
mode="indeterminate"> | |
</mat-progress-spinner> | |
</div> | |
<!-- the application --> | |
<div class="site-container"> |
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 { Injectable } from '@angular/core'; | |
import { | |
HttpRequest, | |
HttpHandler, | |
HttpEvent, | |
HttpInterceptor, HttpResponse | |
} from '@angular/common/http'; | |
import { Observable } from 'rxjs'; | |
import {catchError, map} from 'rxjs/operators' | |
import {LoadingService} from '../../layout/services/loading/loading.service'; |
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
@Injectable({ | |
providedIn: 'root' | |
}) | |
export class ErrorService { | |
public errorEvent: Subject<Error> = new Subject<any>(); | |
constructor( | |
private _ui: UiService | |
) { } |
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
@NgModule({ | |
imports: [ | |
CommonModule, | |
HttpClientModule, | |
MaterialModule | |
], | |
providers: [ | |
{provide: ErrorHandler, useClass: ErrorService} | |
] | |
}) |
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
// This will NOT go through our error handler | |
try { | |
(null as any).f(); | |
} catch (e) { | |
console.error(e); | |
} | |
// This will go through our error handler | |
try { | |
(null as any).f(); |
OlderNewer