X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fapp.service.ts;h=abffc87f195c520bffa86c53f504d0045b0188ea;hb=e7dbeae8d915cdf4470ceb51c2724b04148b30b5;hp=9b582e472a07d1fdf69f1c61558b5666cc1a4471;hpb=c16ce1de8e8c21ad2136335d3b0b7d230e6d2f24;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/app.service.ts b/client/src/app/app.service.ts index 9b582e472..abffc87f1 100644 --- a/client/src/app/app.service.ts +++ b/client/src/app/app.service.ts @@ -1,36 +1,48 @@ -import { Injectable } from '@angular/core'; +/* tslint:disable */ + +import { Injectable } from '@angular/core' export type InternalStateType = { [key: string]: any -}; +} @Injectable() export class AppState { - public _state: InternalStateType = { }; + public _state: InternalStateType = { } - // already return a clone of the current state + /** + * Already return a clone of the current state. + */ public get state() { - return this._state = this._clone(this._state); + return this._state = this._clone(this._state) } - // never allow mutation + /** + * Never allow mutation + */ public set state(value) { - throw new Error('do not mutate the `.state` directly'); + throw new Error('do not mutate the `.state` directly') } public get(prop?: any) { - // use our state getter for the clone - const state = this.state; - return state.hasOwnProperty(prop) ? state[prop] : state; + /** + * Use our state getter for the clone. + */ + const state = this.state + return state.hasOwnProperty(prop) ? state[prop] : state } public set(prop: string, value: any) { - // internally mutate our state - return this._state[prop] = value; + /** + * Internally mutate our state. + */ + return this._state[prop] = value } private _clone(object: InternalStateType) { - // simple object clone - return JSON.parse(JSON.stringify( object )); + /** + * Simple object clone. + */ + return JSON.parse(JSON.stringify( object )) } }