How to use the @jupyterlab/coreutils.URLExt.parse function in @jupyterlab/coreutils

To help you get started, we’ve selected a few @jupyterlab/coreutils 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 yuvipanda / simplest-notebook / packages / rendermime / src / renderers.ts View on Github external
.then(url => {
        // Check protocol again in case it changed:
        if (URLExt.parse(url).protocol !== 'data:') {
          // Bust caching for local src attrs.
          // https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest#Bypassing_the_cache
          url += (/\?/.test(url) ? '&' : '?') + new Date().getTime();
        }
        node.setAttribute(name, url);
      })
      .catch(err => {
github jupyterlab / jupyterlab-data-explorer / packages / rendermime / src / renderers.ts View on Github external
.then(url => {
        // Check protocol again in case it changed:
        if (URLExt.parse(url).protocol !== 'data:') {
          // Bust caching for local src attrs.
          // https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest#Bypassing_the_cache
          url += (/\?/.test(url) ? '&' : '?') + new Date().getTime();
        }
        node.setAttribute(name, url);
      })
      .catch(err => {
github jupyterlab / jupyterlab / packages / rendermime / src / renderers.ts View on Github external
.then(url => {
        // Check protocol again in case it changed:
        if (URLExt.parse(url).protocol !== 'data:') {
          // Bust caching for local src attrs.
          // https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest#Bypassing_the_cache
          url += (/\?/.test(url) ? '&' : '?') + new Date().getTime();
        }
        node.setAttribute(name, url);
      })
      .catch(err => {
github jupyterlab / jupyterlab-data-explorer / jupyterlab / packages / help-extension / src / index.tsx View on Github external
execute: args => {
      const url = args['url'] as string;
      const text = args['text'] as string;

      // If help resource will generate a mixed content error, load externally.
      if (LAB_IS_SECURE && URLExt.parse(url).protocol !== 'https:') {
        window.open(url);
        return;
      }

      let widget = newHelpWidget(url, text);
      void tracker.add(widget);
      shell.add(widget, 'main');
      return widget;
    }
  });
github jupyterlab / jupyterlab-data-explorer / tests / test-coreutils / src / url.spec.ts View on Github external
it('should parse a url into a URLExt object', () => {
        const obj = URLExt.parse('http://www.example.com');
        expect(obj.href).to.equal('http://www.example.com/');
        expect(obj.protocol).to.equal('http:');
        expect(obj.host).to.equal('www.example.com');
        expect(obj.hostname).to.equal('www.example.com');
        expect(obj.pathname).to.equal('/');
      });
github dask / dask-labextension / src / dashboard.tsx View on Github external
export function isLocal(url: string): boolean {
    const { protocol } = URLExt.parse(url);

    return (
      url.toLowerCase().indexOf(protocol!) !== 0 && url.indexOf('//') !== 0
    );
  }
}
github jupyterlab / jupyterlab-data-explorer / jupyterlab / packages / application / src / router.ts View on Github external
get current(): IRouter.ILocation {
    const { base } = this;
    const parsed = URLExt.parse(window.location.href);
    const { search, hash } = parsed;
    const path = parsed.pathname.replace(base, '/');
    const request = path + search + hash;

    return { hash, path, request, search };
  }
github jupyterlab / jupyterlab / packages / application / src / router.ts View on Github external
get current(): IRouter.ILocation {
    const { base } = this;
    const parsed = URLExt.parse(window.location.href);
    const { search, hash } = parsed;
    const path = parsed.pathname?.replace(base, '/') ?? '';
    const request = path + search + hash;

    return { hash, path, request, search };
  }