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


TypeScript URL.createObjectURL方法代碼示例

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


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

示例1: Uploader

    }, (file) => {
      const blobUri: string = URL.createObjectURL(file);

      const uploader = Uploader({
        url: info.url,
        basePath: info.basePath,
        credentials: info.credentials,
        handler: info.handler
      });

      const finalize = () => {
        api.unblock();
        URL.revokeObjectURL(blobUri);
      };

      Utils.blobToDataUri(file).then((dataUrl) => {
        const blobInfo = helpers.createBlobCache(file, blobUri, dataUrl);
        uploader.upload(blobInfo).then((url: string) => {
          api.setData({ src: { value: url, meta: { } } });
          api.showTab('General');
          changeSrc(helpers, info, state, api);
          finalize();
        }).catch((err) => {
          finalize();
          helpers.alertErr(api, err);
        });
      });
    });
開發者ID:tinymce,項目名稱:tinymce,代碼行數:28,代碼來源:Dialog.ts

示例2: function

  Conversions.uriToBlob(base64Src).then(function (blob) {
    blobUriSrc = URL.createObjectURL(blob);

    viewBlock.attach();
    Pipeline.async({}, suite.toSteps({}), function () {
      viewBlock.detach();
      success();
    }, failure);
  });
開發者ID:tinymce,項目名稱:tinymce,代碼行數:9,代碼來源:ImageScannerTest.ts

示例3: function

  const toBlobInfo = function (o: BlobInfoData): BlobInfo {
    let id, name;

    if (!o.blob || !o.base64) {
      throw new Error('blob and base64 representations of the image are required for BlobInfo to be created');
    }

    id = o.id || Uuid.uuid('blobid');
    name = o.name || id;

    return {
      id: Fun.constant(id),
      name: Fun.constant(name),
      filename: Fun.constant(name + '.' + mimeToExt(o.blob.type)),
      blob: Fun.constant(o.blob),
      base64: Fun.constant(o.base64),
      blobUri: Fun.constant(o.blobUri || URL.createObjectURL(o.blob)),
      uri: Fun.constant(o.uri)
    };
  };
開發者ID:danielpunkass,項目名稱:tinymce,代碼行數:20,代碼來源:BlobCache.ts

示例4: function

  return function (evt) {
    const Throbber = Factory.get('Throbber');
    const rootControl = evt.control.rootControl;
    const throbber = new Throbber(rootControl.getEl());
    const file = evt.control.value();
    const blobUri = URL.createObjectURL(file);

    const uploader = Uploader({
      url: Settings.getUploadUrl(editor),
      basePath: Settings.getUploadBasePath(editor),
      credentials: Settings.getUploadCredentials(editor),
      handler: Settings.getUploadHandler(editor)
    });

    const finalize = function () {
      throbber.hide();
      URL.revokeObjectURL(blobUri);
    };

    throbber.show();

    return Utils.blobToDataUri(file).then(function (dataUrl) {
      const blobInfo = editor.editorUpload.blobCache.create({
        blob: file,
        blobUri,
        name: file.name ? file.name.replace(/\.[^\.]+$/, '') : null, // strip extension
        base64: dataUrl.split(',')[1]
      });
      return uploader.upload(blobInfo).then(function (url) {
        const src = rootControl.find('#src');
        src.value(url);
        rootControl.find('tabpanel')[0].activateTab(0); // switch to General tab
        src.fire('change'); // this will invoke onSrcChange (and any other handlers, if any).
        finalize();
        return url;
      });
    }).catch(function (err) {
      editor.windowManager.alert(err);
      finalize();
    });
  };
開發者ID:abstask,項目名稱:tinymce,代碼行數:41,代碼來源:UploadTab.ts

示例5: createState

function createState(blob) {
  return {
    blob,
    url: URL.createObjectURL(blob)
  };
}
開發者ID:danielpunkass,項目名稱:tinymce,代碼行數:6,代碼來源:Dialog.ts

示例6:

 Conversions.uriToBlob(base64Src).then(function (blob) {
   blobUriSrc = URL.createObjectURL(blob);
 });
開發者ID:tinymce,項目名稱:tinymce,代碼行數:3,代碼來源:ImageScannerTest.ts

示例7:

const createState = (blob: Blob): ImageToolsState => {
  return {
    blob,
    url: URL.createObjectURL(blob)
  };
};
開發者ID:tinymce,項目名稱:tinymce,代碼行數:6,代碼來源:Dialog.ts


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