This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class ForMapOfContext<T> { | |
destroyed = false; | |
constructor(readonly $implicit: T) {} | |
} | |
@Directive({selector: '[ngForMap][ngForMapOf]'}) | |
export class ForMapOfDirective<T, G> { | |
@Input() | |
set ngForMapOf(map: Map<T, G>) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class ForMapOfContext<T> { | |
destroyed = false; | |
constructor(readonly $implicit: T) {} | |
} | |
@Directive({selector: '[ngForMap][ngForMapOf]'}) | |
export class ForMapOfDirective<T, G> { | |
@Input() | |
set ngForMapOf(map: Map<T, G>) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Filtering SVGElements for TreeWalker | |
// Filter must be a function in IE, other modern browsers are compliant to this format | |
export const svgNodeFilter: NodeFilter = ((node: Node) => | |
'ownerSVGElement' in node | |
? NodeFilter.FILTER_REJECT | |
: NodeFilter.FILTER_ACCEPT) as any; | |
/** | |
* Range.setStart/setEnd, except it uses offset in characters only | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// TypeScript parser based on Dean Taylor's answer: | |
// https://stackoverflow.com/a/20238168/2706426 | |
// | |
interface GradientStop { | |
color: string; | |
position?: string; | |
} | |
interface ParsedGraient { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fetch('http://localhost:9222/json') | |
.then(response => response.json()) | |
.then(([response]) => { | |
const socket = new WebSocket(response.webSocketDebuggerUrl); | |
socket.onopen = () => { | |
socket.send( | |
JSON.stringify({ | |
id: 1, | |
method: 'Browser.grantPermissions', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class Sanitizer { | |
abstract sanitize(context: SecurityContext, value: string | {}): string | null | |
} | |
abstract class DomSanitizer implements Sanitizer { | |
abstract sanitize(context: SecurityContext, value: string | SafeValue): string | null | |
abstract bypassSecurityTrustHtml(value: string): SafeHtml | |
abstract bypassSecurityTrustStyle(value: string): SafeStyle | |
abstract bypassSecurityTrustScript(value: string): SafeScript | |
abstract bypassSecurityTrustUrl(value: string): SafeUrl |