当前位置: 首页>>代码示例>>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;未经允许,请勿转载。