@angular-extensions/elements
Advanced tools
Comparing version 12.1.2 to 12.4.1
@@ -351,3 +351,4 @@ (function (global, factory) { | ||
var LazyElementsLoaderService = /** @class */ (function () { | ||
function LazyElementsLoaderService(registry, options) { | ||
function LazyElementsLoaderService(errorHandler, registry, options) { | ||
this.errorHandler = errorHandler; | ||
this.registry = registry; | ||
@@ -394,3 +395,9 @@ this.options = options; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var config, notifier_1, beforeLoadHook, afterLoadHook_1, script_1; | ||
// The `load` and `error` event listeners capture `this`. That's why they have to be removed manually. | ||
// Otherwise, the `LazyElementsLoaderService` is not going to be GC'd. | ||
function cleanup() { | ||
script_1.removeEventListener('load', onLoad_1); | ||
script_1.removeEventListener('error', onError_1); | ||
} | ||
var config, notifier_1, beforeLoadHook, afterLoadHook_1, script_1, onLoad_1, onError_1; | ||
var _this = this; | ||
@@ -432,3 +439,3 @@ return __generator(this, function (_o) { | ||
script_1.src = url; | ||
script_1.onload = function () { | ||
onLoad_1 = function () { | ||
if (afterLoadHook_1) { | ||
@@ -442,4 +449,14 @@ _this.handleHook(afterLoadHook_1, tag) | ||
} | ||
cleanup(); | ||
}; | ||
script_1.onerror = notifier_1.reject; | ||
onError_1 = function (error) { | ||
notifier_1.reject(error); | ||
cleanup(); | ||
// Caretaker note: don't put it before the `reject` and `cleanup` since the user may have some | ||
// custom error handler that will re-throw the error through `throw error`. Hence the code won't | ||
// be executed, and the promise won't be rejected. | ||
_this.errorHandler.handleError(error); | ||
}; | ||
script_1.addEventListener('load', onLoad_1); | ||
script_1.addEventListener('error', onError_1); | ||
if (beforeLoadHook) { | ||
@@ -503,3 +520,3 @@ this.handleHook(beforeLoadHook, tag) | ||
}()); | ||
LazyElementsLoaderService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.0", ngImport: i0__namespace, type: LazyElementsLoaderService, deps: [{ token: LAZY_ELEMENTS_REGISTRY }, { token: LAZY_ELEMENT_ROOT_OPTIONS, optional: true }], target: i0__namespace.ɵɵFactoryTarget.Injectable }); | ||
LazyElementsLoaderService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.0", ngImport: i0__namespace, type: LazyElementsLoaderService, deps: [{ token: i0__namespace.ErrorHandler }, { token: LAZY_ELEMENTS_REGISTRY }, { token: LAZY_ELEMENT_ROOT_OPTIONS, optional: true }], target: i0__namespace.ɵɵFactoryTarget.Injectable }); | ||
LazyElementsLoaderService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.0.0", ngImport: i0__namespace, type: LazyElementsLoaderService, providedIn: 'root' }); | ||
@@ -512,3 +529,3 @@ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.0", ngImport: i0__namespace, type: LazyElementsLoaderService, decorators: [{ | ||
}], ctorParameters: function () { | ||
return [{ type: undefined, decorators: [{ | ||
return [{ type: i0__namespace.ErrorHandler }, { type: undefined, decorators: [{ | ||
type: i0.Inject, | ||
@@ -515,0 +532,0 @@ args: [LAZY_ELEMENTS_REGISTRY] |
import { __awaiter } from "tslib"; | ||
import { Inject, Injectable, Optional } from '@angular/core'; | ||
import { Inject, Injectable, Optional, } from '@angular/core'; | ||
import { LAZY_ELEMENT_ROOT_OPTIONS, LAZY_ELEMENTS_REGISTRY, } from './lazy-elements.tokens'; | ||
@@ -7,3 +7,4 @@ import * as i0 from "@angular/core"; | ||
export class LazyElementsLoaderService { | ||
constructor(registry, options) { | ||
constructor(errorHandler, registry, options) { | ||
this.errorHandler = errorHandler; | ||
this.registry = registry; | ||
@@ -77,3 +78,3 @@ this.options = options; | ||
script.src = url; | ||
script.onload = () => { | ||
const onLoad = () => { | ||
if (afterLoadHook) { | ||
@@ -87,4 +88,20 @@ this.handleHook(afterLoadHook, tag) | ||
} | ||
cleanup(); | ||
}; | ||
script.onerror = notifier.reject; | ||
const onError = (error) => { | ||
notifier.reject(error); | ||
cleanup(); | ||
// Caretaker note: don't put it before the `reject` and `cleanup` since the user may have some | ||
// custom error handler that will re-throw the error through `throw error`. Hence the code won't | ||
// be executed, and the promise won't be rejected. | ||
this.errorHandler.handleError(error); | ||
}; | ||
// The `load` and `error` event listeners capture `this`. That's why they have to be removed manually. | ||
// Otherwise, the `LazyElementsLoaderService` is not going to be GC'd. | ||
function cleanup() { | ||
script.removeEventListener('load', onLoad); | ||
script.removeEventListener('error', onError); | ||
} | ||
script.addEventListener('load', onLoad); | ||
script.addEventListener('error', onError); | ||
if (beforeLoadHook) { | ||
@@ -135,3 +152,3 @@ this.handleHook(beforeLoadHook, tag) | ||
} | ||
LazyElementsLoaderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.0", ngImport: i0, type: LazyElementsLoaderService, deps: [{ token: LAZY_ELEMENTS_REGISTRY }, { token: LAZY_ELEMENT_ROOT_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); | ||
LazyElementsLoaderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.0", ngImport: i0, type: LazyElementsLoaderService, deps: [{ token: i0.ErrorHandler }, { token: LAZY_ELEMENTS_REGISTRY }, { token: LAZY_ELEMENT_ROOT_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); | ||
LazyElementsLoaderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.0.0", ngImport: i0, type: LazyElementsLoaderService, providedIn: 'root' }); | ||
@@ -143,3 +160,3 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.0", ngImport: i0, type: LazyElementsLoaderService, decorators: [{ | ||
}] | ||
}], ctorParameters: function () { return [{ type: undefined, decorators: [{ | ||
}], ctorParameters: function () { return [{ type: i0.ErrorHandler }, { type: undefined, decorators: [{ | ||
type: Inject, | ||
@@ -153,2 +170,2 @@ args: [LAZY_ELEMENTS_REGISTRY] | ||
}] }]; } }); | ||
//# sourceM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Q29uZmlnLnRhZyk7XG4gICAgICBpZiAoZXhpc3RpbmdDb25maWcpIHtcbiAgICAgICAgbmdEZXZNb2RlICYmXG4gICAgICAgICAgY29uc29sZS53YXJuKFxuICAgICAgICAgICAgYCR7TE9HX1BSRUZJWH0gLSBFbGVtZW50Q29uZmlnIGZvciB0YWcgJyR7bmV3Q29uZmlnLnRhZ30nIHdhcyBwcmV2aW91c2x5IGFkZGVkLCBpdCB3aWxsIG5vdCBiZSBhZGRlZCBtdWx0aXBsZSB0aW1lcywgY29udGludWUuLi5gXG4gICAgICAgICAgKTtcbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIG5ld0NvbmZpZy5pc0FkZGVkID0gdHJ1ZTtcbiAgICAgICAgdGhpcy5jb25maWdzLnB1c2gobmV3Q29uZmlnKTtcbiAgICAgICAgY29uc3Qgc2hvdWxkUHJlbG9hZCA9XG4gICAgICAgICAgbmV3Q29uZmlnLnByZWxvYWQgIT09IHVuZGVmaW5lZFxuICAgICAgICAgICAgPyBuZXdDb25maWcucHJlbG9hZFxuICAgICAgICAgICAgOiB0aGlzLm9wdGlvbnMucHJlbG9hZDtcbiAgICAgICAgaWYgKHNob3VsZFByZWxvYWQpIHtcbiAgICAgICAgICB0aGlzLmxvYWRFbGVtZW50KFxuICAgICAgICAgICAgbmV3Q29uZmlnLnVybCxcbiAgICAgICAgICAgIG5ld0NvbmZpZy50YWcsXG4gICAgICAgICAgICBuZXdDb25maWcuaXNNb2R1bGUsXG4gICAgICAgICAgICBuZXdDb25maWcuaW1wb3J0TWFwLFxuICAgICAgICAgICAgbmV3Q29uZmlnLmhvb2tzXG4gICAgICAgICAgKTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH0pO1xuICB9XG5cbiAgZ2V0RWxlbWVudENvbmZpZyh0YWc6IHN0cmluZyk6IEVsZW1lbnRDb25maWcge1xuICAgIHJldHVybiB0aGlzLmNvbmZpZ3MuZmluZCgoY29uZmlnKSA9PiBjb25maWcudGFnID09PSB0YW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AgICBpZiAoaXNNb2R1bGUpIHtcbiAgICAgICAgc2NyaXB0LnR5cGUgPSAnbW9kdWxlJztcbiAgICAgIH1cbiAgICAgIHNjcmlwdC5zcmMgPSB1cmw7XG4gICAgICBzY3JpcHQub25sb2FkID0gKCkgPT4ge1xuICAgICAgICBpZiAoYWZ0ZXJMb2FkSG9vaykge1xuICAgICAgICAgIHRoaXMuaGFuZGxlSG9vayhhZnRlckxvYWRIb29rLCB0YWcpXG4gICAgICAgICAgICAudGhlbihub3RpZmllci5yZXNvbHZlKVxuICAgICAgICAgICAgLmNhdGNoKG5vdGlmaWVyLnJlamVjdCk7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgbm90aWZpZXIucmVzb2x2ZSgpO1xuICAgICAgICB9XG4gICAgICB9O1xuICAgICAgc2NyaXB0Lm9uZXJyb3IgPSBub3RpZmllci5yZWplY3Q7XG4gICAgICBpZiAoYmVmb3JlTG9hZEhvb2spIHtcbiAgICAgICAgdGhpcy5oYW5kbGVIb29rKGJlZm9yZUxvYWRIb29rLCB0YWcpXG4gICAgICAgICAgLnRoZW4oKCkgPT4gZG9jdW1lbnQuYm9keS5hcHBlbmRDaGlsZChzY3JpcHQpKVxuICAgICAgICAgIC5jYXRjaChub3RpZmllci5yZWplY3QpO1xuICAgICAgfSBlbHNlIHtcbiAgICAgICAgZG9jdW1lbnQuYm9keS5hcHBlbmRDaGlsZChzY3JpcHQpO1xuICAgICAgfVxuICAgIH1cbiAgICByZXR1cm4gdGhpcy5yZWdpc3RyeS5nZXQodGhpcy5zdHJpcFVybFByb3RvY29sKHVybCkpO1xuICB9XG5cbiAgcHJpdmF0ZSBhZGRFbGVtZW50KHVybDogc3RyaW5nKTogTm90aWZpZXIge1xuICAgIGxldCBub3RpZmllcjogTm90aWZpZXI7XG4gICAgdGhpcy5yZWdpc3RyeS5zZXQoXG4gICAgICB0aGlzLnN0cmlwVXJsUHJvdG9jb2wodXJsKSxcbiAgICAgIG5ldyBQcm9taXNlP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5mb3JFYWNoKChuZXdDb25maWcpID0+IHtcbiAgICAgIGNvbnN0IGV4aXN0aW5nQ29uZmlnID0gdGhpcy5nZXRFbGVtZW50Q29uZmlnKG5ld0NvbmZpZy50YWcpO1xuICAgICAgaWYgKGV4aXN0aW5nQ29uZmlnKSB7XG4gICAgICAgIG5nRGV2TW9kZSAmJlxuICAgICAgICAgIGNvbnNvbGUud2FybihcbiAgICAgICAgICAgIGAke0xPR19QUkVGSVh9IC0gRWxlbWVudENvbmZpZyBmb3IgdGFnICcke25ld0NvbmZpZy50YWd9JyB3YXMgcHJldmlvdXNseSBhZGRlZCwgaXQgd2lsbCBub3QgYmUgYWRkZWQgbXVsdGlwbGUgdGltZXMsIGNvbnRpbnVlLi4uYFxuICAgICAgICAgICk7XG4gICAgICB9IGVsc2Uge1xuICAgICAgICBuZXdDb25maWcuaXNBZGRlZCA9IHRydWU7XG4gICAgICAgIHRoaXMuY29uZmlncy5wdXNoKG5ld0NvbmZpZyk7XG4gICAgICAgIGNvbnN0IHNob3VsZFByZWxvYWQgPVxuICAgICAgICAgIG5ld0NvbmZpZy5wcmVsb2FkICE9PSB1bmRlZmluZWRcbiAgICAgICAgICAgID8gbmV3Q29uZmlnLnByZWxvYWRcbiAgICAgICAgICAgIDogdGhpcy5vcHRpb25zLnByZWxvYWQ7XG4gICAgICAgIGlmIChzaG91bGRQcmVsb2FkKSB7XG4gICAgICAgICAgdGhpcy5sb2FkRWxlbWVudChcbiAgICAgICAgICAgIG5ld0NvbmZpZy51cmwsXG4gICAgICAgICAgICBuZXdDb25maWcudGFnLFxuICAgICAgICAgICAgbmV3Q29uZmlnLmlzTW9kdWxlLFxuICAgICAgICAgICAgbmV3Q29uZmlnLmltcG9ydE1hcCxcbiAgICAgICAgICAgIG5ld0NvbmZpZy5ob29rc1xuICAgICAgICAgICk7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9KTtcbiAgfVxuXG4gIGdldEVsZW1lbnRDb25maWcodGFnOiBzdHJpbmc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lmIChuZ0Rldk1vZGUpIHtcbiAgICAgIHRocm93IG5ldyBFcnJvcihcbiAgICAgICAgYCR7TE9HX1BSRUZJWH0gLSBpbXBvcnRNYXAgZmVhdHVyZSBkZXBlbmRzIG9uIFN5c3RlbUpTIGxpYnJhcnkgdG8gYmUgZ2xvYmFsbHkgbG9hZGVkIGJ1dCBub25lIHdhcyBmb3VuZCwgdGh1cyAnJHt1cmx9JyBjYW4ndCBiZSByZXNvbHZlZC4gWW91IHNob3VsZCBlaXRoZXIgbG9hZCBTeXN0ZW1KUyBvciByZW1vdmUgdGhlIGltcG9ydE1hcCBmbGFnLmBcbiAgICAgICk7XG4gICAgfVxuICAgIHJldHVybiB1cmw7XG4gIH1cbn1cblxuaW50ZXJmYWNlIE5vdGlmaWVyIHtcbiAgcmVzb2x2ZTogKCkgPT4gdm9pZDtcbiAgcmVqZWN0OiAoZXJyb3I6IGFueSkgPT4gdm9pZDtcbn1cbiJdfQ== |
@@ -18,3 +18,4 @@ import * as i0 from '@angular/core'; | ||
class LazyElementsLoaderService { | ||
constructor(registry, options) { | ||
constructor(errorHandler, registry, options) { | ||
this.errorHandler = errorHandler; | ||
this.registry = registry; | ||
@@ -88,3 +89,3 @@ this.options = options; | ||
script.src = url; | ||
script.onload = () => { | ||
const onLoad = () => { | ||
if (afterLoadHook) { | ||
@@ -98,4 +99,20 @@ this.handleHook(afterLoadHook, tag) | ||
} | ||
cleanup(); | ||
}; | ||
script.onerror = notifier.reject; | ||
const onError = (error) => { | ||
notifier.reject(error); | ||
cleanup(); | ||
// Caretaker note: don't put it before the `reject` and `cleanup` since the user may have some | ||
// custom error handler that will re-throw the error through `throw error`. Hence the code won't | ||
// be executed, and the promise won't be rejected. | ||
this.errorHandler.handleError(error); | ||
}; | ||
// The `load` and `error` event listeners capture `this`. That's why they have to be removed manually. | ||
// Otherwise, the `LazyElementsLoaderService` is not going to be GC'd. | ||
function cleanup() { | ||
script.removeEventListener('load', onLoad); | ||
script.removeEventListener('error', onError); | ||
} | ||
script.addEventListener('load', onLoad); | ||
script.addEventListener('error', onError); | ||
if (beforeLoadHook) { | ||
@@ -146,3 +163,3 @@ this.handleHook(beforeLoadHook, tag) | ||
} | ||
LazyElementsLoaderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.0", ngImport: i0, type: LazyElementsLoaderService, deps: [{ token: LAZY_ELEMENTS_REGISTRY }, { token: LAZY_ELEMENT_ROOT_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); | ||
LazyElementsLoaderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.0", ngImport: i0, type: LazyElementsLoaderService, deps: [{ token: i0.ErrorHandler }, { token: LAZY_ELEMENTS_REGISTRY }, { token: LAZY_ELEMENT_ROOT_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); | ||
LazyElementsLoaderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.0.0", ngImport: i0, type: LazyElementsLoaderService, providedIn: 'root' }); | ||
@@ -154,3 +171,3 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.0", ngImport: i0, type: LazyElementsLoaderService, decorators: [{ | ||
}] | ||
}], ctorParameters: function () { return [{ type: undefined, decorators: [{ | ||
}], ctorParameters: function () { return [{ type: i0.ErrorHandler }, { type: undefined, decorators: [{ | ||
type: Inject, | ||
@@ -157,0 +174,0 @@ args: [LAZY_ELEMENTS_REGISTRY] |
@@ -1,2 +0,2 @@ | ||
import { Type } from '@angular/core'; | ||
import { ErrorHandler, Type } from '@angular/core'; | ||
import { LazyElementRootOptions } from './lazy-elements.module'; | ||
@@ -22,6 +22,7 @@ import { LazyElementsRegistry } from './lazy-elements.tokens'; | ||
export declare class LazyElementsLoaderService { | ||
private errorHandler; | ||
private registry; | ||
options: LazyElementRootOptions; | ||
configs: ElementConfig[]; | ||
constructor(registry: LazyElementsRegistry, options: LazyElementRootOptions); | ||
constructor(errorHandler: ErrorHandler, registry: LazyElementsRegistry, options: LazyElementRootOptions); | ||
addConfigs(newConfigs: ElementConfig[]): void; | ||
@@ -36,4 +37,4 @@ getElementConfig(tag: string): ElementConfig; | ||
private resolveImportMap; | ||
static ɵfac: i0.ɵɵFactoryDeclaration<LazyElementsLoaderService, [null, { optional: true; }]>; | ||
static ɵfac: i0.ɵɵFactoryDeclaration<LazyElementsLoaderService, [null, null, { optional: true; }]>; | ||
static ɵprov: i0.ɵɵInjectableDeclaration<LazyElementsLoaderService>; | ||
} |
{ | ||
"name": "@angular-extensions/elements", | ||
"version": "12.1.2", | ||
"version": "12.4.1", | ||
"peerDependencies": { | ||
@@ -5,0 +5,0 @@ "@angular/common": ">=12", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
290874
2219