]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/app.service.ts
Client: add basic aot support
[github/Chocobozzz/PeerTube.git] / client / src / app / app.service.ts
index 033c21900affe152a7221f5edd8428ec51aee103..9b582e472a07d1fdf69f1c61558b5666cc1a4471 100644 (file)
@@ -1,35 +1,35 @@
-
 import { Injectable } from '@angular/core';
 
+export type InternalStateType = {
+  [key: string]: any
+};
+
 @Injectable()
 export class AppState {
-  _state = { };
 
-  constructor() { ; }
+  public _state: InternalStateType = { };
 
   // already return a clone of the current state
-  get state() {
+  public get state() {
     return this._state = this._clone(this._state);
   }
   // never allow mutation
-  set state(value) {
+  public set state(value) {
     throw new Error('do not mutate the `.state` directly');
   }
 
-
-  get(prop?: any) {
+  public get(prop?: any) {
     // use our state getter for the clone
     const state = this.state;
     return state.hasOwnProperty(prop) ? state[prop] : state;
   }
 
-  set(prop: string, value: any) {
+  public set(prop: string, value: any) {
     // internally mutate our state
     return this._state[prop] = value;
   }
 
-
-  _clone(object) {
+  private _clone(object: InternalStateType) {
     // simple object clone
     return JSON.parse(JSON.stringify( object ));
   }