mirror of
https://github.com/grafana/grafana.git
synced 2025-02-12 00:25:46 -06:00
24 lines
488 B
TypeScript
24 lines
488 B
TypeScript
///<reference path="../../headers/require/require.d.ts" />
|
|
|
|
export class BundleLoader {
|
|
lazy: any;
|
|
loadingDefer: any;
|
|
|
|
constructor(bundleName) {
|
|
this.lazy = ["$q", "$route", "$rootScope", ($q, $route, $rootScope) => {
|
|
if (this.loadingDefer) {
|
|
return this.loadingDefer.promise;
|
|
}
|
|
|
|
this.loadingDefer = $q.defer();
|
|
|
|
require([bundleName], () => {
|
|
this.loadingDefer.resolve();
|
|
});
|
|
|
|
return this.loadingDefer.promise;
|
|
}];
|
|
|
|
}
|
|
}
|