当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript katamari.Arr类代码示例

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


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

示例1:

 return Chain.mapper(function (parents: Element[]) {
   const names = Arr.map(parents, Node.name);
   Assertions.assertEq('Should be expected names', expectedNames, names);
   return {};
 });
开发者ID:danielpunkass,项目名称:tinymce,代码行数:5,代码来源:ParentsTest.ts

示例2: normalizeDeep

const normalizeEntries = (entries: Entry[]): void => {
  Arr.foldl(entries, (outline: Array<Option<Entry>>, entry) => {
    return entry.depth > outline.length ? normalizeDeep(outline, entry) : normalizeShallow(outline, entry);
  }, []);
};
开发者ID:mdgbayly,项目名称:tinymce,代码行数:5,代码来源:NormalizeEntries.ts

示例3: function


//.........这里部分代码省略.........
      };
    };

    const callback = function () {
      eventUtils.unbind(window, 'click', callback);
      data += 'b';
    };

    data = '';
    eventUtils.bind(window, 'click', append('a'));
    eventUtils.bind(window, 'click', callback);
    eventUtils.bind(window, 'click', append('c'));

    eventUtils.fire(window, 'click', {});
    LegacyUnit.equal(data, 'abc');

    data = '';
    eventUtils.fire(window, 'click', {});
    LegacyUnit.equal(data, 'ac');
  });

  suite.test('ready/DOMContentLoaded (domLoaded = true)', function () {
    let evt;

    eventUtils.bind(window, 'ready', function (e) {
      evt = e;
    });
    LegacyUnit.equal(evt.type, 'ready');
  });

  suite.test('ready/DOMContentLoaded (document.readyState check)', function () {
    let evt;

    try {
      document.readyState = 'loading';
    } catch (e) {
      LegacyUnit.equal(true, true, 'IE doesn\'t allow us to set document.readyState');
      return;
    }

    eventUtils.domLoaded = false;
    document.readyState = 'loading';
    eventUtils.bind(window, 'ready', function (e) {
      evt = e;
    });
    LegacyUnit.equal(true, typeof (evt) !== 'undefined');

    eventUtils.domLoaded = false;
    document.readyState = 'complete';
    eventUtils.bind(window, 'ready', function (e) {
      evt = e;
    });
    LegacyUnit.equal(evt.type, 'ready');
  });

  suite.test('isDefaultPrevented', function () {
    const testObj: any = {};
    const testCallback = function () {
      return 'hello';
    };
    testObj.isDefaultPrevented = testCallback;
    eventUtils.fire(window, 'testEvent', testObj);

    LegacyUnit.equal(testObj.isDefaultPrevented !== testCallback, true, 'Is overwritten by our isDefaultPrevented');
    LegacyUnit.equal(typeof testObj.isPropagationStopped, 'function', 'Has our isPropagationStopped');
    LegacyUnit.equal(typeof testObj.isImmediatePropagationStopped, 'function', 'Has our isImmediatePropagationStopped');
  });

  const sAddTestDiv = Step.sync(function () {
    const testDiv = document.createElement('div');
    testDiv.id = 'testDiv';
    testDiv.innerHTML = (
      '<div id="content" tabindex="0">' +
      '<div id="inner" tabindex="0"></div>' +
      '</div>'
    );

    document.body.appendChild(testDiv);
  });

  const sRemoveTestDiv = Step.sync(function () {
    const testDiv = document.querySelector('#testDiv');
    testDiv.parentNode.removeChild(testDiv);
  });

  let steps = Arr.bind(suite.toSteps({}), function (step) {
    return [
      step,
      Step.sync(function () {
        eventUtils.clean(window);
      })
    ];
  });

  steps = [sAddTestDiv].concat(steps).concat(sRemoveTestDiv);

  Pipeline.async({}, steps, function () {
    success();
  }, failure);
});
开发者ID:tinymce,项目名称:tinymce,代码行数:101,代码来源:EventUtilsTest.ts

示例4:

 parser.addNodeFilter('p', (nodes) => {
   Arr.each(nodes, (node) => {
     node.attr('class', 'x');
   });
 });
开发者ID:tinymce,项目名称:tinymce,代码行数:5,代码来源:DomParserTest.ts

示例5: function

 const update = function () {
   clear();
   const rectangles = Rectangles.getRectangles(win);
   const spans = Arr.map(rectangles, make);
   InsertAll.append(container, spans);
 };
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:6,代码来源:FakeSelection.ts

示例6: function

 Arr.each(SelectorFilter.descendants(tableElm, 'tr'), function (tr, y) {
   Arr.each(SelectorFilter.descendants(tr, 'td,th'), function (td, x) {
     fillout(table, skipCellsX(table, x, y), y, tr, td);
   });
 });
开发者ID:abstask,项目名称:tinymce,代码行数:5,代码来源:SimpleTableModel.ts

示例7: function

 const join = function (items) {
   return Arr.foldl(items, function (a, b) {
     const bothEmpty = a.length === 0 || b.length === 0;
     return bothEmpty ? a.concat(b) : a.concat(separator, b);
   }, []);
 };
开发者ID:howardjing,项目名称:tinymce,代码行数:6,代码来源:FilePicker.ts

示例8: function

const getParentCell = function (rootElm, elm) {
  return Arr.find(Parents.parentsAndSelf(elm, rootElm), ElementType.isTableCell);
};
开发者ID:enigmatic-user,项目名称:tinymce-1,代码行数:3,代码来源:TableDelete.ts

示例9: function

 const isRoot = function (element) {
   const name = Node.name(element);
   return Compare.eq(element, body) || Arr.contains(rootElements, name);
 };
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:4,代码来源:TabContext.ts


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