feat(core): add has method to dom insertion service

#3496
pull/3681/head
mehmet-erim 6 years ago
parent 8f8b71b484
commit 5da683c3bc

@ -4,7 +4,7 @@ import { generateHash } from '../utils';
@Injectable({ providedIn: 'root' })
export class DomInsertionService {
readonly inserted = new Set<number>();
private readonly inserted = new Set<number>();
insertContent<T extends HTMLScriptElement | HTMLStyleElement>(
contentStrategy: ContentStrategy<T>,
@ -25,4 +25,10 @@ export class DomInsertionService {
element.parentNode.removeChild(element);
}
has(content: string): boolean {
const hash = generateHash(content);
return this.inserted.has(hash);
}
}

Loading…
Cancel
Save