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
Highcharts.Chart.prototype.callbacks.push(function(chart) { | |
var hasTouch = hasTouch = document.documentElement.ontouchstart !== undefined, | |
mouseTracker = chart.pointer, | |
container = chart.container, | |
mouseMove; | |
mouseMove = function (e) { | |
// let the system handle multitouch operations like two finger scroll | |
// and pinching | |
if (e && e.touches && e.touches.length > 0) { |
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
#!/usr/bin/env node | |
var pkg = require('./package.json'); | |
var fs = require('fs'); | |
var hint = require("jshint").JSHINT; | |
var uglify = require('uglify-js'); | |
var banner = '/*! iScroll v' + pkg.version + ' ~ (c) 2008-' + (new Date().getFullYear()) + ' Matteo Spinelli ~ http://cubiq.org/license */\n'; | |
var releases = { |
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 { Injectable } from '@angular/core'; | |
import { UserManager, User } from 'oidc-client'; | |
@Injectable() | |
export class AuthService { | |
private userManager: UserManager; | |
constructor () { | |
this.userManager = new UserManager({ |
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 { Injectable } from '@angular/core'; | |
import { HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http'; | |
import { Observable } from 'rxjs/Observable'; | |
import { AuthService } from './auth.service'; | |
@Injectable() | |
export class TokenInterceptor implements HttpInterceptor { | |
constructor (private auth: AuthService) {} | |
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 { NgModule } from '@angular/core'; | |
import { BrowserModule } from '@angular/platform-browser'; | |
import { CommonModule } from '@angular/common'; | |
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http'; | |
import { AppComponent } from '/app.component'; | |
import { AuthService } from './auth.service'; | |
import { TokenInterceptor } from './token.interceptor'; | |
@NgModule({ | |
declarations: [ |
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 { Component, OnInit } from '@angular/core'; | |
import { HttpClient } from '@angular/common/http'; | |
@Component({ | |
selector: 'my-app', | |
template: '<div></div>' | |
}) | |
export class AppComponent implements OnInit { | |
constructor (private http: HttpClient) {} |
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
intercept (request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> { | |
return next.handle(request); | |
} |
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
// THIS DOESN'T WORK! | |
intercept (request, next) { | |
this.auth.getUser().then(user => { | |
// ... modify the request here ... | |
next.handle(request); | |
}); | |
} |
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 { Observable } from 'rxjs/Observable'; | |
import 'rxjs/add/observable/fromPromise'; |
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
getUser (): Observable<User> { | |
return Observable.fromPromise(this.userManager.getUser()); | |
} |
OlderNewer