1- /// <reference path="./index.d.ts" />
2-
31import './services/core-services.service' ;
4- import { ICore , IResource } from './interfaces' ;
2+ import { ICore , IService } from './interfaces' ;
53
64export class Core implements ICore {
7- public rootPath : string = 'http://url/' ;
8- public resources : Object = { } ;
5+ private resourceServices : Object = { } ;
96
107 public loadingsCounter : number = 0 ;
118 public loadingsStart = ( ) => { } ;
129 public loadingsDone = ( ) => { } ;
1310 public loadingsError = ( ) => { } ;
1411 public loadingsOffline = ( ) => { } ;
1512
16- public static Me : ICore = null ;
17- public static Services : any = null ;
13+ public static me : ICore ;
14+ public static injectedServices : any ;
1815
1916 /** @ngInject */
2017 public constructor (
2118 protected rsJsonapiConfig ,
2219 protected JsonapiCoreServices
2320 ) {
24- Core . Me = this ;
25- Core . Services = JsonapiCoreServices ;
21+ Core . me = this ;
22+ Core . injectedServices = JsonapiCoreServices ;
2623 }
2724
28- public _register ( clase : IResource ) : boolean {
29- if ( clase . type in this . resources ) {
25+ public _register ( clase : IService ) : boolean {
26+ if ( clase . type in this . resourceServices ) {
3027 return false ;
3128 }
32- this . resources [ clase . type ] = clase ;
29+ this . resourceServices [ clase . type ] = clase ;
3330 return true ;
3431 }
3532
36- public getResource ( type : string ) : IResource {
37- return this . resources [ type ] ;
33+ public getResourceService ( type : string ) : IService {
34+ return this . resourceServices [ type ] ;
3835 }
3936
4037 public refreshLoadings ( factor : number ) : void {
@@ -46,4 +43,5 @@ export class Core implements ICore {
4643 }
4744 }
4845}
46+
4947angular . module ( 'Jsonapi.services' ) . service ( 'JsonapiCore' , Core ) ;
0 commit comments