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


TypeScript Type.isFunction方法代碼示例

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


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

示例1: Event

const fireEvent = (elem: Element, event: string) => {
  let evt;
  if (Type.isFunction(Event)) {
    evt = new Event(event, {
      bubbles: true,
      cancelable: true
    });
  } else { // support IE
    evt = document.createEvent('Event');
    evt.initEvent(event, true, true);
  }
  elem.dom().dispatchEvent(evt);
};
開發者ID:tinymce,項目名稱:tinymce,代碼行數:13,代碼來源:TestLinkUi.ts

示例2: function

const renderThemeUi = function (editor) {
  const settings = editor.settings, elm = editor.getElement();

  editor.orgDisplay = elm.style.display;

  if (Type.isString(settings.theme)) {
    return renderFromLoadedTheme(editor);
  } else if (Type.isFunction(settings.theme)) {
    return renderFromThemeFunc(editor);
  } else {
    return renderThemeFalse(editor);
  }
};
開發者ID:mdgbayly,項目名稱:tinymce,代碼行數:13,代碼來源:Init.ts

示例3: Event

 Chain.op(function (elm: Element) {
   const element: HTMLElement = elm.dom();
   // NOTE we can't fake a paste event here.
   let event;
   if (Type.isFunction(Event)) {
     event = new Event(name, {
       bubbles: true,
       cancelable: true
     });
   } else { // support IE
     event = document.createEvent('Event');
     event.initEvent(name, true, true);
   }
   element.dispatchEvent(event);
 }),
開發者ID:tinymce,項目名稱:tinymce,代碼行數:15,代碼來源:Utils.ts

示例4: function

 const toString = function (obj) {
   if (Type.isFunction(obj)) {
     return Object.prototype.toString.call(obj);
   }
   return !isEmpty(obj) ? '' + obj : '';
 };
開發者ID:tinymce,項目名稱:tinymce,代碼行數:6,代碼來源:I18n.ts

示例5: function


//.........這裏部分代碼省略.........
      blobInfo,
      status: false,
      error
    };
  };

  const resolvePending = function (blobUri, result) {
    Tools.each(pendingPromises[blobUri], function (resolve) {
      resolve(result);
    });

    delete pendingPromises[blobUri];
  };

  const uploadBlobInfo = function (blobInfo, handler, openNotification) {
    uploadStatus.markPending(blobInfo.blobUri());

    return new Promise(function (resolve) {
      let notification, progress;

      const noop = function () {
      };

      try {
        const closeNotification = function () {
          if (notification) {
            notification.close();
            progress = noop; // Once it's closed it's closed
          }
        };

        const success = function (url) {
          closeNotification();
          uploadStatus.markUploaded(blobInfo.blobUri(), url);
          resolvePending(blobInfo.blobUri(), handlerSuccess(blobInfo, url));
          resolve(handlerSuccess(blobInfo, url));
        };

        const failure = function (error) {
          closeNotification();
          uploadStatus.removeFailed(blobInfo.blobUri());
          resolvePending(blobInfo.blobUri(), handlerFailure(blobInfo, error));
          resolve(handlerFailure(blobInfo, error));
        };

        progress = function (percent) {
          if (percent < 0 || percent > 100) {
            return;
          }

          if (!notification) {
            notification = openNotification();
          }

          notification.progressBar.value(percent);
        };

        handler(blobInfo, success, failure, progress);
      } catch (ex) {
        resolve(handlerFailure(blobInfo, ex.message));
      }
    });
  };

  const isDefaultHandler = function (handler) {
    return handler === defaultHandler;
  };

  const pendingUploadBlobInfo = function (blobInfo) {
    const blobUri = blobInfo.blobUri();

    return new Promise(function (resolve) {
      pendingPromises[blobUri] = pendingPromises[blobUri] || [];
      pendingPromises[blobUri].push(resolve);
    });
  };

  const uploadBlobs = function (blobInfos, openNotification) {
    blobInfos = Tools.grep(blobInfos, function (blobInfo) {
      return !uploadStatus.isUploaded(blobInfo.blobUri());
    });

    return Promise.all(Tools.map(blobInfos, function (blobInfo) {
      return uploadStatus.isPending(blobInfo.blobUri()) ?
        pendingUploadBlobInfo(blobInfo) : uploadBlobInfo(blobInfo, settings.handler, openNotification);
    }));
  };

  const upload = function (blobInfos, openNotification) {
    return (!settings.url && isDefaultHandler(settings.handler)) ? noUpload() : uploadBlobs(blobInfos, openNotification);
  };

  if (Type.isFunction(settings.handler) === false) {
    settings.handler = defaultHandler;
  }

  return {
    upload
  };
}
開發者ID:danielpunkass,項目名稱:tinymce,代碼行數:101,代碼來源:Uploader.ts

示例6: function

const hasSelectionModifyApi = function (editor) {
  return Type.isFunction(editor.selection.getSel().modify);
};
開發者ID:howardjing,項目名稱:tinymce,代碼行數:3,代碼來源:WordSelection.ts

示例7:

export const getValidationHandler = (editor: Editor): Option<UrlValidationHandler> => {
  const validatorHandler = editor.settings.filepicker_validator_handler;
  return Type.isFunction(validatorHandler) ? Option.some(validatorHandler) : Option.none();
};
開發者ID:tinymce,項目名稱:tinymce,代碼行數:4,代碼來源:UrlInputBackstage.ts


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