當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript URLExt.parse方法代碼示例

本文整理匯總了TypeScript中@jupyterlab/coreutils.URLExt.parse方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript URLExt.parse方法的具體用法?TypeScript URLExt.parse怎麽用?TypeScript URLExt.parse使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在@jupyterlab/coreutils.URLExt的用法示例。


在下文中一共展示了URLExt.parse方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: it

 it('should handle query and hash', () => {
   const url = "http://example.com/path?that's#all, folks";
   const obj = URLExt.parse(url);
   try {
     expect(obj.href).to.equal(
       'http://example.com/path?that%27s#all,%20folks'
     );
   } catch (e) {
     // Chrome
     expect(obj.href).to.equal(
       'http://example.com/path?that%27s#all, folks'
     );
   }
   expect(obj.protocol).to.equal('http:');
   expect(obj.host).to.equal('example.com');
   expect(obj.hostname).to.equal('example.com');
   expect(obj.search).to.equal('?that%27s');
   expect(obj.pathname).to.equal('/path');
   try {
     expect(obj.hash).to.equal('#all,%20folks');
   } catch (e) {
     // Chrome
     expect(obj.hash).to.equal('#all, folks');
   }
 });
開發者ID:afshin,項目名稱:jupyterlab,代碼行數:25,代碼來源:url.spec.ts

示例2: Date

 .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);
 })
開發者ID:jupyter,項目名稱:jupyterlab,代碼行數:9,代碼來源:renderers.ts

示例3: handleAttr

 /**
  * Handle a node with a `src` or `href` attribute.
  */
 function handleAttr(node: HTMLElement, name: 'src' | 'href', resolver: IRenderMime.IResolver): Promise<void> {
   let source = node.getAttribute(name);
   if (!source || URLExt.parse(source).protocol === 'data:') {
     return Promise.resolve(undefined);
   }
   node.setAttribute(name, '');
   return resolver.resolveUrl(source).then(path => {
     return resolver.getDownloadUrl(path);
   }).then(url => {
     node.setAttribute(name, url);
   });
 }
開發者ID:cameronoelsen,項目名稱:jupyterlab,代碼行數:15,代碼來源:renderers.ts

示例4: newClosableIFrame

    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 iframe = newClosableIFrame(url, text);
      shell.addToMainArea(iframe);
      tracker.activate(iframe);
    }
開發者ID:charnpreetsingh185,項目名稱:jupyterlab,代碼行數:14,代碼來源:index.ts

示例5: handleAttr

 /**
  * Handle a node with a `src` or `href` attribute.
  */
 function handleAttr(node: HTMLElement, name: 'src' | 'href', resolver: IRenderMime.IResolver): Promise<void> {
   let source = node.getAttribute(name);
   if (!source || URLExt.parse(source).protocol === 'data:') {
     return Promise.resolve(undefined);
   }
   node.setAttribute(name, '');
   return resolver.resolveUrl(source).then(path => {
     return resolver.getDownloadUrl(path);
   }).then(url => {
     node.setAttribute(name, url);
   }).catch(err => {
     // If there was an error getting the url,
     // just make it an empty link.
     node.setAttribute(name, '');
   });
 }
開發者ID:7125messi,項目名稱:jupyterlab,代碼行數:19,代碼來源:renderers.ts

示例6: handleAttr

 /**
  * Handle a node with a `src` or `href` attribute.
  */
 function handleAttr(node: HTMLElement, name: 'src' | 'href', resolver: IRenderMime.IResolver): Promise<void> {
   let source = node.getAttribute(name);
   if (!source || URLExt.parse(source).protocol === 'data:') {
     return Promise.resolve(undefined);
   }
   node.setAttribute(name, '');
   return resolver.resolveUrl(source).then(path => {
     return resolver.getDownloadUrl(path);
   }).then(url => {
     // 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 => {
     // If there was an error getting the url,
     // just make it an empty link.
     node.setAttribute(name, '');
   });
 }
開發者ID:SimonBiggs,項目名稱:jupyterlab,代碼行數:22,代碼來源:renderers.ts

示例7:

 handleLink: (node: HTMLElement, path: string) => {
   if (!URLExt.parse(path).protocol && path.indexOf('//') !== 0) {
     linker.connectNode(node, 'file-operations:open', { path });
   }
 }
開發者ID:charnpreetsingh185,項目名稱:jupyterlab,代碼行數:5,代碼來源:index.ts


注:本文中的@jupyterlab/coreutils.URLExt.parse方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。