17
17
18
18
import { IOHandler } from './types' ;
19
19
20
- export type IORouter = ( url : string | string [ ] , onProgress ?: Function ) => IOHandler ;
20
+ export type IORouter = ( url : string | string [ ] , onProgress ?: Function ) =>
21
+ IOHandler ;
21
22
22
23
export class IORouterRegistry {
23
24
// Singleton instance.
@@ -79,13 +80,14 @@ export class IORouterRegistry {
79
80
* @returns All valid handlers for `url`, given the currently registered
80
81
* handler routers.
81
82
*/
82
- static getLoadHandlers ( url : string | string [ ] ,
83
- onProgress ?: Function ) : IOHandler [ ] {
83
+ static getLoadHandlers ( url : string | string [ ] , onProgress ?: Function ) :
84
+ IOHandler [ ] {
84
85
return IORouterRegistry . getHandlers ( url , 'load' , onProgress ) ;
85
86
}
86
87
87
- private static getHandlers ( url : string | string [ ] , handlerType : 'save' | 'load' ,
88
- onProgress ?: Function ) : IOHandler [ ] {
88
+ private static getHandlers (
89
+ url : string | string [ ] , handlerType : 'save' | 'load' ,
90
+ onProgress ?: Function ) : IOHandler [ ] {
89
91
const validHandlers : IOHandler [ ] = [ ] ;
90
92
const routers = handlerType === 'load' ? this . getInstance ( ) . loadRouters :
91
93
this . getInstance ( ) . saveRouters ;
@@ -98,3 +100,12 @@ export class IORouterRegistry {
98
100
return validHandlers ;
99
101
}
100
102
}
103
+
104
+ export const registerSaveRouter = ( loudRouter : IORouter ) =>
105
+ IORouterRegistry . registerSaveRouter ( loudRouter ) ;
106
+ export const registerLoadRouter = ( loudRouter : IORouter ) =>
107
+ IORouterRegistry . registerLoadRouter ( loudRouter ) ;
108
+ export const getSaveHandlers = ( url : string | string [ ] ) =>
109
+ IORouterRegistry . getSaveHandlers ( url ) ;
110
+ export const getLoadHandlers = ( url : string | string [ ] , onProgress ?: Function ) =>
111
+ IORouterRegistry . getLoadHandlers ( url ) ;
0 commit comments