How to use the whatwg-url.URL.createObjectURL function in whatwg-url

To help you get started, we’ve selected a few whatwg-url examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sourcegraph / sourcegraph / packages / webapp / src / polyfills.ts View on Github external
// This gets automatically expanded into
// imports that only pick what we need
import '@babel/polyfill'

// Polyfill URL because Chrome and Firefox are not spec-compliant
// Hostnames of URIs with custom schemes (e.g. git) are not parsed out
import { URL, URLSearchParams } from 'whatwg-url'
// The polyfill does not expose createObjectURL, which we need for creating data: URIs for Web
// Workers. So retain it.
URL.createObjectURL = window.URL.createObjectURL
Object.assign(window, { URL, URLSearchParams })
github StoDevX / AAO-React-Native / source / init / monkey-patch--url.js View on Github external
* window.URL global object for URL parsing.
 *
 * RN provides a global URL object… but only puts two things into it.
 *
 * The JSDOM project maintains a browser-compatible URL module.
 *
 * Thus, we stick that into the global namespace, and monkey-patch RN's
 * two non-standard methods onto it so as to not break either things that
 * expect web!URL or RN!URL objects.
 */

import {URL, URLSearchParams} from 'whatwg-url'

let RNURL = global.URL

URL.createObjectURL = RNURL.createObjectURL
URL.revokeObjectURL = RNURL.revokeObjectURL

global.URL = URL
global.URLSearchParams = URLSearchParams