ng-inline-svg
Advanced tools
Comparing version 6.2.1 to 7.0.0
@@ -32,5 +32,4 @@ "use strict"; | ||
]; | ||
InlineSVGModule.ctorParameters = function () { return []; }; | ||
return InlineSVGModule; | ||
}()); | ||
exports.InlineSVGModule = InlineSVGModule; |
import { RendererFactory2 } from '@angular/core'; | ||
import { HttpClient } from '@angular/common/http'; | ||
import { Observable } from 'rxjs/Observable'; | ||
import 'rxjs/add/observable/of'; | ||
import 'rxjs/add/operator/catch'; | ||
import 'rxjs/add/operator/finally'; | ||
import 'rxjs/add/operator/map'; | ||
import 'rxjs/add/operator/share'; | ||
import { Observable } from 'rxjs'; | ||
import { InlineSVGConfig } from './inline-svg.config'; | ||
@@ -10,0 +5,0 @@ export declare class SVGCacheService { |
@@ -5,8 +5,4 @@ "use strict"; | ||
var http_1 = require("@angular/common/http"); | ||
var Observable_1 = require("rxjs/Observable"); | ||
require("rxjs/add/observable/of"); | ||
require("rxjs/add/operator/catch"); | ||
require("rxjs/add/operator/finally"); | ||
require("rxjs/add/operator/map"); | ||
require("rxjs/add/operator/share"); | ||
var rxjs_1 = require("rxjs"); | ||
var operators_1 = require("rxjs/operators"); | ||
var inline_svg_config_1 = require("./inline-svg.config"); | ||
@@ -32,3 +28,3 @@ var SVGCacheService = (function () { | ||
if (cache && SVGCacheService._cache.has(absUrl)) { | ||
return Observable_1.Observable.of(this._cloneSVG(SVGCacheService._cache.get(absUrl))); | ||
return rxjs_1.of(this._cloneSVG(SVGCacheService._cache.get(absUrl))); | ||
} | ||
@@ -39,12 +35,9 @@ if (SVGCacheService._inProgressReqs.has(absUrl)) { | ||
var req = this._http.get(absUrl, { responseType: 'text' }) | ||
.catch(function (err) { return err; }) | ||
.finally(function () { | ||
.pipe(operators_1.catchError(function (err) { return err; }), operators_1.finalize(function () { | ||
SVGCacheService._inProgressReqs.delete(absUrl); | ||
}) | ||
.share() | ||
.map(function (svgText) { | ||
}), operators_1.share(), operators_1.map(function (svgText) { | ||
var svgEl = _this._svgElementFromString(svgText); | ||
SVGCacheService._cache.set(absUrl, svgEl); | ||
return _this._cloneSVG(svgEl); | ||
}); | ||
})); | ||
SVGCacheService._inProgressReqs.set(absUrl, req); | ||
@@ -51,0 +44,0 @@ return req; |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":4,"metadata":{"SVGCacheService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":11,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":21,"character":5}}],null,null],"parameters":[{"__symbolic":"reference","module":"./inline-svg.config","name":"InlineSVGConfig","line":21,"character":24},{"__symbolic":"reference","module":"@angular/common/http","name":"HttpClient","line":22,"character":19},{"__symbolic":"reference","module":"@angular/core","name":"RendererFactory2","line":23,"character":21}]}],"getSVG":[{"__symbolic":"method"}],"setBaseUrl":[{"__symbolic":"method"}],"getAbsoluteUrl":[{"__symbolic":"method"}],"_svgElementFromString":[{"__symbolic":"method"}],"_cloneSVG":[{"__symbolic":"method"}]},"statics":{"_cache":{"__symbolic":"error","message":"Variable not initialized","line":13,"character":17},"_inProgressReqs":{"__symbolic":"error","message":"Variable not initialized","line":14,"character":17},"_baseUrl":{"__symbolic":"error","message":"Variable not initialized","line":16,"character":17}}}}}] | ||
[{"__symbolic":"module","version":4,"metadata":{"SVGCacheService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":8,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":18,"character":5}}],null,null],"parameters":[{"__symbolic":"reference","module":"./inline-svg.config","name":"InlineSVGConfig","line":18,"character":24},{"__symbolic":"reference","module":"@angular/common/http","name":"HttpClient","line":19,"character":19},{"__symbolic":"reference","module":"@angular/core","name":"RendererFactory2","line":20,"character":21}]}],"getSVG":[{"__symbolic":"method"}],"setBaseUrl":[{"__symbolic":"method"}],"getAbsoluteUrl":[{"__symbolic":"method"}],"_svgElementFromString":[{"__symbolic":"method"}],"_cloneSVG":[{"__symbolic":"method"}]},"statics":{"_cache":{"__symbolic":"error","message":"Variable not initialized","line":10,"character":17},"_inProgressReqs":{"__symbolic":"error","message":"Variable not initialized","line":11,"character":17},"_baseUrl":{"__symbolic":"error","message":"Variable not initialized","line":13,"character":17}}}}}] |
{ | ||
"name": "ng-inline-svg", | ||
"version": "6.2.1", | ||
"version": "7.0.0", | ||
"description": "Angular directive for inserting an SVG inline within an element.", | ||
@@ -37,17 +37,17 @@ "repository": { | ||
"peerDependencies": { | ||
"@angular/core": ">=5.0.0", | ||
"@angular/common": ">=5.0.0" | ||
"@angular/core": ">=6.0.0", | ||
"@angular/common": ">=6.0.0" | ||
}, | ||
"devDependencies": { | ||
"@angular/common": "^5.2.9", | ||
"@angular/compiler": "^5.2.9", | ||
"@angular/compiler-cli": "^5.2.9", | ||
"@angular/core": "^5.2.9", | ||
"@angular/platform-browser": "^5.2.9", | ||
"@angular/common": "^6.0.0", | ||
"@angular/compiler": "^6.0.0", | ||
"@angular/compiler-cli": "^6.0.0", | ||
"@angular/core": "^6.0.0", | ||
"@angular/platform-browser": "^6.0.0", | ||
"rimraf": "^2.6.2", | ||
"rxjs": "^5.5.7", | ||
"tslint": "^5.9.1", | ||
"typescript": "^2.5.3", | ||
"zone.js": "^0.8.20" | ||
"rxjs": "^6.1.0", | ||
"tslint": "^5.10.0", | ||
"typescript": "~2.7.2", | ||
"zone.js": "^0.8.26" | ||
} | ||
} |
@@ -87,3 +87,3 @@ # ng-inline-svg | ||
| fallbackImgUrl | string | | URL for a regular image to be displayed as a fallback if the SVG fails to load. | | ||
| onSVGLoaded | `(svg: SVGElement, parent: Element | null) => SVGElement` | | Lifecycle hook that allows the loaded SVG to be manipulated prior to insertion. | | ||
| onSVGLoaded | `(svg: SVGElement, parent: Element \| null) => SVGElement` | | Lifecycle hook that allows the loaded SVG to be manipulated prior to insertion. | | ||
@@ -90,0 +90,0 @@ #### Outputs |
@@ -19,3 +19,3 @@ import { | ||
import { isPlatformBrowser, isPlatformServer } from '@angular/common'; | ||
import { Subscription } from 'rxjs/Subscription'; | ||
import { Subscription } from 'rxjs'; | ||
@@ -22,0 +22,0 @@ import { InlineSVGComponent } from './inline-svg.component'; |
import { Injectable, Optional, Renderer2, RendererFactory2 } from '@angular/core'; | ||
import { HttpClient } from '@angular/common/http'; | ||
import { Observable } from 'rxjs/Observable'; | ||
import 'rxjs/add/observable/of'; | ||
import 'rxjs/add/operator/catch'; | ||
import 'rxjs/add/operator/finally'; | ||
import 'rxjs/add/operator/map'; | ||
import 'rxjs/add/operator/share'; | ||
import { Observable, of } from 'rxjs'; | ||
import { map, finalize, catchError, share } from 'rxjs/operators'; | ||
import { InlineSVGConfig } from './inline-svg.config'; | ||
@@ -45,3 +42,3 @@ | ||
if (cache && SVGCacheService._cache.has(absUrl)) { | ||
return Observable.of(this._cloneSVG(SVGCacheService._cache.get(absUrl))); | ||
return of(this._cloneSVG(SVGCacheService._cache.get(absUrl))); | ||
} | ||
@@ -55,13 +52,15 @@ | ||
// Otherwise, make the HTTP call to fetch | ||
const req = this._http.get(absUrl, { responseType: 'text' }) | ||
.catch((err: any) => err) | ||
.finally(() => { | ||
SVGCacheService._inProgressReqs.delete(absUrl); | ||
}) | ||
.share() | ||
.map((svgText: string) => { | ||
const svgEl = this._svgElementFromString(svgText); | ||
SVGCacheService._cache.set(absUrl, svgEl); | ||
return this._cloneSVG(svgEl); | ||
}); | ||
const req = this._http.get(absUrl, {responseType: 'text'}) | ||
.pipe( | ||
catchError((err: any) => err), | ||
finalize(() => { | ||
SVGCacheService._inProgressReqs.delete(absUrl); | ||
}), | ||
share(), | ||
map((svgText: string) => { | ||
const svgEl = this._svgElementFromString(svgText); | ||
SVGCacheService._cache.set(absUrl, svgEl); | ||
return this._cloneSVG(svgEl); | ||
}) | ||
); | ||
@@ -113,2 +112,3 @@ SVGCacheService._inProgressReqs.set(absUrl, req); | ||
} | ||
} |
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
53573
916