• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript katamari.Future类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中@ephox/katamari.Future的典型用法代码示例。如果您正苦于以下问题:TypeScript Future类的具体用法?TypeScript Future怎么用?TypeScript Future使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Future类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: function

  const check = function (label, initial, destination, amount) {
    return Future.nu(function (callback) {
      let current = initial;
      let values = [ current ];

      const add = function (val, abort) {
        if (val > 100) {
          abort('abort');
        } else {
          current = val;
          values = values.concat([ val ]);
        }
      };

      animator.animate(function () {
        return current;
      }, destination, amount, add, function (s) {
        add(s, Fun.identity);
        callback({
          label,
          info: {
            current,
            values
          }
        });
      }, 2);
    });
  };
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:28,代码来源:AsyncSmoothAnimationTest.ts


示例2: function

const moveOnlyScroll = function (element, destination) {
  return Future.nu(function (callback) {
    const getCurrent = Fun.curry(getScrollTop, element);
    Attr.set(element, lastScroll, getCurrent());

    const update = function (newScroll, abort) {
      const previous = DataAttributes.safeParse(element, lastScroll);
      // As soon as we detect a scroll value that we didn't set, assume the user
      // is scrolling, and abort the scrolling.
      if (previous !== element.dom().scrollTop) {
        abort(element.dom().scrollTop);
      } else {
        element.dom().scrollTop = newScroll;
        Attr.set(element, lastScroll, newScroll);
      }
    };

    const finish = function (/* dest */) {
      element.dom().scrollTop = destination;
      Attr.set(element, lastScroll, destination);
      callback(destination);
    };

    // Identify the number of steps based on distance (consistent time)
    const distance = Math.abs(destination - getCurrent());
    const step = Math.ceil(distance / NUM_TOP_ANIMATION_FRAMES);
    animator.animate(getCurrent, destination, step, update, finish, ANIMATION_RATE);
  });
};
开发者ID:abstask,项目名称:tinymce,代码行数:29,代码来源:IosScrolling.ts


示例3: createPartialChoiceMenu

 fetch: (comp) => {
   return Future.nu((callback) => {
     return spec.fetch(callback);
   }).map((items) => {
     return Option.from(createTieredDataFrom(
       Merger.deepMerge(
         createPartialChoiceMenu(
           Id.generate('menu-value'),
           items,
           (value) => {
             spec.onItemAction(comp, value);
           },
           spec.columns,
           spec.presets,
           ItemResponse.CLOSE_ON_EXECUTE,
           // No colour is ever selected on opening
           () => false,
           sharedBackstage.providers
         ),
         {
           movement: deriveMenuMovement(spec.columns, spec.presets)
         }
       )
     ));
   });
 },
开发者ID:tinymce,项目名称:tinymce,代码行数:26,代码来源:PanelButton.ts


示例4: return

 return (comp: AlloyComponent): Future<Option<TieredData>> => {
   return Future.nu((callback) => {
     return spec.fetch(callback);
   }).map((items) => {
     return Option.from(createTieredDataFrom(
       Merger.deepMerge(
         createPartialChoiceMenu(
           Id.generate('menu-value'),
           items,
           (value) => {
             spec.onItemAction(getApi(comp), value);
           },
           spec.columns,
           spec.presets,
           ItemResponse.CLOSE_ON_EXECUTE,
           spec.select.getOr(() => false),
           providersBackstage
         ),
         {
           movement: deriveMenuMovement(spec.columns, spec.presets),
           menuBehaviours: SimpleBehaviours.unnamedEvents(spec.columns !== 'auto' ? [ ] : [
             AlloyEvents.runOnAttached((comp, se) => {
               detectSize(comp, 4, classForPreset(spec.presets)).each(({ numRows, numColumns }) => {
                 Keying.setGridSize(comp, numRows, numColumns);
               });
             })
           ])
         } as TieredMenuTypes.PartialMenuSpec
       )
     ));
   });
 };
开发者ID:tinymce,项目名称:tinymce,代码行数:32,代码来源:ToolbarButtons.ts


示例5: function

 const loadF = function (url) {
   return Future.nu(function (resolve) {
     load(
       url,
       Fun.compose(resolve, Fun.constant(Result.value(url))),
       Fun.compose(resolve, Fun.constant(Result.error(url)))
     );
   });
 };
开发者ID:tinymce,项目名称:tinymce,代码行数:9,代码来源:StyleSheetLoader.ts


示例6:

          validate: (input) => {
            const inputValue = Representing.getValue(input);
            // Consider empty strings valid colours
            if (inputValue.length === 0) {
              return Future.pure(Result.value(true));
            } else {
              const span = Element.fromTag('span');
              Css.set(span, 'background-color', inputValue);

              const res = Css.getRaw(span, 'background-color').fold(
                // TODO: Work out what we want to do here.
                () => Result.error('blah'),
                (_) => Result.value(inputValue)
              );

              return Future.pure(res);
            }
          }
开发者ID:tinymce,项目名称:tinymce,代码行数:18,代码来源:ColorInput.ts


示例7: completer

const collect = (editor): Future<ImageDialogInfo> => {

  const urlListSanitizer = ListUtils.sanitizer((item) => {
    return editor.convertURL(item.value || item.url, 'src');
  });

  const futureImageList = Future.nu<Option<ListItem[]>>((completer) => {
    Utils.createImageList(editor, (imageList) => {
      completer(
        urlListSanitizer(imageList).map(
          (items) => Arr.flatten([
            [{ text: 'None', value: '' }],
            items
          ])
        )
      );
    });
  });
  const classList = ListUtils.sanitize(Settings.getClassList(editor));
  const hasAdvTab = Settings.hasAdvTab(editor);
  const hasUploadUrl = Settings.hasUploadUrl(editor);
  const hasUploadHandler = Settings.hasUploadHandler(editor);
  const image = readImageDataFromSelection(editor);
  const hasDescription = Settings.hasDescription(editor);
  const hasImageTitle = Settings.hasImageTitle(editor);
  const hasDimensions = Settings.hasDimensions(editor);
  const hasImageCaption = Settings.hasImageCaption(editor);
  const url = Settings.getUploadUrl(editor);
  const basePath = Settings.getUploadBasePath(editor);
  const credentials = Settings.getUploadCredentials(editor);
  const handler = Settings.getUploadHandler(editor);
  const prependURL: Option<string> = Option.some(Settings.getPrependUrl(editor)).filter(
    (preUrl) => Type.isString(preUrl) && preUrl.length > 0);

  return futureImageList.map((imageList): ImageDialogInfo => {
    return {
      image,
      imageList,
      classList,
      hasAdvTab,
      hasUploadUrl,
      hasUploadHandler,
      hasDescription,
      hasImageTitle,
      hasDimensions,
      hasImageCaption,
      url,
      basePath,
      credentials,
      handler,
      prependURL
    };
  });
};
开发者ID:tinymce,项目名称:tinymce,代码行数:54,代码来源:DialogInfo.ts


示例8: resolve

  return Futures.mapM(items, (item: any) => {
    return Future.nu((resolve) => {
      const blob = item.getAsFile ? item.getAsFile() : item;

      const reader = new window.FileReader();
      reader.onload = () => {
        resolve({
          blob,
          uri: reader.result
        });
      };
      reader.readAsDataURL(blob);
    });
  });
开发者ID:mdgbayly,项目名称:tinymce,代码行数:14,代码来源:Clipboard.ts


示例9: makeDialog

const open = function (editor: Editor) {
  const data = collectData(editor);
  data.map((info) => {
    const onSubmit = handleSubmit(editor, info, Settings.assumeExternalTargets(editor.settings));
    return makeDialog(info, onSubmit, editor.settings);
  }).get((spec) => {
    editor.windowManager.open(spec);
  });
};
开发者ID:tinymce,项目名称:tinymce,代码行数:9,代码来源:Dialog.ts



注:本文中的@ephox/katamari.Future类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript katamari.Futures类代码示例发布时间:2022-05-28
下一篇:
TypeScript katamari.Fun类代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap