UNPKG

812 BPlain TextView Raw
1/******** Debug Logging ********/
2
3// tslint:disable-next-line: no-empty
4let debugLogImpl = (s: string) => {};
5
6export function debugLog(s: string) {
7 debugLogImpl(s);
8}
9
10export function setDebugLog(logFn: (s: string) => void) {
11 debugLogImpl = logFn;
12}
13
14/******** Warnings ********/
15
16let showWarnings = true;
17
18export function suppressWarnings() {
19 showWarnings = false;
20}
21
22export function shouldShowWarnings(): boolean {
23 return showWarnings;
24}
25
26// Workaround for:
27// - IE9 (can't bind console functions directly), and
28// - Edge Issue #14495220 (referencing `console` without F12 Developer Tools can cause an exception)
29function warnOrLog() {
30 // tslint:disable-next-line: no-console
31 (console.warn || console.log).apply(console, arguments);
32}
33
34export const warn = warnOrLog.bind("[clipboard-polyfill]");