Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | 2x 2x 2x 2x 2x 2x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x | import { STATE_SYMBOL } from '../constants.js'; import { VERSION } from '../../../version.js'; import { snapshot } from '../../shared/clone.js'; import * as w from '../warnings.js'; export function install_custom_formatter() { // Custom formatters are 'supported' in Firefox, but they're worse than useless. // They're not supported in Firefox. We can maybe tweak this over time var is_chrome = typeof navigator !== 'undefined' && navigator.userAgent.includes('Chrome'); var custom_formatters_enabled = false; if (is_chrome) { // @ts-expect-error (window.devtoolsFormatters ??= []).push({ /** * @param {any} object * @param {any} config */ header(object, config) { custom_formatters_enabled = true; if (STATE_SYMBOL in object) { return [ 'div', {}, ['span', { style: 'font-weight: bold' }, '$state'], ['object', { object: snapshot(object), config }] ]; } return null; }, hasBody: () => false }); } // the arguments need to include an object, so that we discover // whether custom formatters are enabled // eslint-disable-next-line no-console console.log(`Running Svelte in development mode`, { version: VERSION }); if (is_chrome && !custom_formatters_enabled) { w.enable_custom_formatters(); } } |