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


TypeScript Fun.compose方法代碼示例

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


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

示例1: function

    const wrapEvent = function (event) {
      // IE9 minimum
      const target = Element.fromDom(event.target);

      const stop = function () {
        event.stopPropagation();
      };

      const prevent = function () {
        event.preventDefault();
      };

      const kill = Fun.compose(prevent, stop); // more of a sequence than a compose, but same effect

      // FIX: Don't just expose the raw event. Need to identify what needs standardisation.
      return {
        target:  Fun.constant(target),
        x:       Fun.constant(event.x),
        y:       Fun.constant(event.y),
        stop,
        prevent,
        kill,
        raw:     Fun.constant(event)
      };
    };
開發者ID:,項目名稱:,代碼行數:25,代碼來源:

示例2: function

 const sAssertSelectBoxDisplayValue = function (editor, title, expectedValue) {
   return Chain.asStep(Element.fromDom(document.body), [
     UiFinder.cFindIn('*[aria-label="' + title + '"]'),
     Chain.mapper(Fun.compose(Strings.trim, TextContent.get)),
     Assertions.cAssertEq('Should be the expected display value', expectedValue)
   ]);
 };
開發者ID:danielpunkass,項目名稱:tinymce,代碼行數:7,代碼來源:FontSelectTest.ts

示例3: function

const findLocationSimple = function (forward, location) {
  if (forward) {
    return location.fold(
      Fun.compose(Option.some, Location.start), // Before -> Start
      Option.none,
      Fun.compose(Option.some, Location.after), // End -> After
      Option.none
    );
  } else {
    return location.fold(
      Option.none,
      Fun.compose(Option.some, Location.before), // Before <- Start
      Option.none,
      Fun.compose(Option.some, Location.end) // End <- After
    );
  }
};
開發者ID:aha-app,項目名稱:tinymce-word-paste-filter,代碼行數:17,代碼來源:BoundaryLocation.ts

示例4: return

  }
  return fontSize;
};

const normalizeFontFamily = (fontFamily: string) => {
  // 'Font name', Font -> Font name,Font
  return fontFamily.replace(/[\'\"\\]/g, '').replace(/,\s+/g, ',');
};

const getComputedFontProp = (propName: string, elm: HTMLElement): Option<string> => {
  return Option.from(DOMUtils.DOM.getStyle(elm, propName, true));
};

const getFontProp = (propName: string) => {
  return (rootElm: Element, elm: Node): string => {
    return Option.from(elm)
      .map(SugarElement.fromDom)
      .filter(SugarNode.isElement)
      .bind((element: any) => {
        return getSpecifiedFontProp(propName, rootElm, element.dom())
          .or(getComputedFontProp(propName, element.dom()));
      })
      .getOr('');
  };
};

export default {
  getFontSize: getFontProp('font-size'),
  getFontFamily: Fun.compose(normalizeFontFamily, getFontProp('font-family')) as (rootElm: Element, elm: Node) => string,
  toPt
};
開發者ID:tinymce,項目名稱:tinymce,代碼行數:31,代碼來源:FontInfo.ts

示例5: function

 const createGroups = function (gs) {
   return Arr.map(gs, Fun.compose(ToolbarGroup.sketch, makeGroup));
 };
開發者ID:abstask,項目名稱:tinymce,代碼行數:3,代碼來源:ScrollingToolbar.ts


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