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


TypeScript algorithm.ArrayExt类代码示例

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


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

示例1: it

 it('should be reset when loading from disk', () => {
   let model = new NotebookModel();
   let cell = model.contentFactory.createCodeCell({});
   model.cells.pushBack(cell);
   model.fromJSON(DEFAULT_CONTENT);
   expect(ArrayExt.firstIndexOf(toArray(model.cells), cell)).to.be(-1);
   expect(model.cells.length).to.be(6);
 });
开发者ID:rlugojr,项目名称:jupyterlab,代码行数:8,代码来源:model.spec.ts

示例2: it

 it('adjust after inserting an item', function() {
     const insertedValue = 'value-before-1';
     ArrayExt.insert(sequence, 1, insertedValue);
     // sequence is now [value-0, value-before-1, value-1]
     selection.adjustSelectionForInsert(1, insertedValue);
     expect(selection.index).to.equal(1);
     expect(selection.value).to.equal(insertedValue);
 });
开发者ID:mmeanwe,项目名称:ipywidgets,代码行数:8,代码来源:currentselection_test.ts

示例3: _resolve

 /**
  * Resolve a button item.
  */
 private _resolve(item: Dialog.IButton): void {
   // Prevent loopback.
   let promise = this._promise;
   this._promise = null;
   this.close();
   ArrayExt.removeFirstOf(Private.launchQueue, promise.promise);
   promise.resolve(item);
 }
开发者ID:eskirk,项目名称:jupyterlab,代码行数:11,代码来源:dialog.ts

示例4: it

 it('should be reset when loading from disk', () => {
   const model = new NotebookModel();
   const cell = model.contentFactory.createCodeCell({});
   model.cells.push(cell);
   model.fromJSON(NBTestUtils.DEFAULT_CONTENT);
   expect(ArrayExt.firstIndexOf(toArray(model.cells), cell)).to.equal(-1);
   expect(model.cells.length).to.equal(6);
 });
开发者ID:jupyter,项目名称:jupyterlab,代码行数:8,代码来源:model.spec.ts

示例5: dispose

 /**
  * Dispose of the resources used by the dialog.
  */
 dispose(): void {
   const promise = this._promise;
   if (promise) {
     this._promise = null;
     promise.reject(void 0);
     ArrayExt.removeFirstOf(Private.launchQueue, promise.promise);
   }
   super.dispose();
 }
开发者ID:cameronoelsen,项目名称:jupyterlab,代码行数:12,代码来源:dialog.ts

示例6: hitTestNodes

 export function hitTestNodes(
   nodes: HTMLElement[] | HTMLCollection,
   x: number,
   y: number
 ): number {
   return ArrayExt.findFirstIndex(nodes, node => {
     return ElementExt.hitTest(node, x, y);
   });
 }
开发者ID:SylvainCorlay,项目名称:jupyterlab,代码行数:9,代码来源:domutils.ts

示例7: dispose

 /**
  * Dispose of the resources used by the dialog.
  */
 dispose(): void {
   if (this._promise) {
     let promise = this._promise;
     this._promise = null;
     promise.resolve(void 0);
     ArrayExt.removeFirstOf(Private.launchQueue, promise.promise);
   }
   super.dispose();
 }
开发者ID:charnpreetsingh185,项目名称:jupyterlab,代码行数:12,代码来源:dialog.ts

示例8: _evtDragEnter

 /**
  * Handle the `'p-dragenter'` event for the widget.
  */
 private _evtDragEnter(event: IDragEvent): void {
   if (event.mimeData.hasData(CONTENTS_MIME)) {
     let index = ArrayExt.findFirstIndex(this._crumbs, node => ElementExt.hitTest(node, event.clientX, event.clientY));
     if (index !== -1) {
       if (index !== Private.Crumb.Current) {
         this._crumbs[index].classList.add(DROP_TARGET_CLASS);
         event.preventDefault();
         event.stopPropagation();
       }
     }
   }
 }
开发者ID:cameronoelsen,项目名称:jupyterlab,代码行数:15,代码来源:crumbs.ts

示例9: it

      it('should remove a group from the menu', () => {
        const group1 = [ { command: 'run1'}, { command: 'run2' }];
        const group2 = [ { command: 'run3'}, { command: 'run4' }];
        menu.addGroup(group1);
        menu.addGroup(group2);
        menu.removeGroup(group1);

        let idx1 = ArrayExt.findFirstIndex(menu.menu.items,
                                           m => m.command === 'run1');
        let idx2 = ArrayExt.findFirstIndex(menu.menu.items,
                                           m => m.command === 'run2');
        let idx3 = ArrayExt.findFirstIndex(menu.menu.items,
                                           m => m.command === 'run3');
        let idx4 = ArrayExt.findFirstIndex(menu.menu.items,
                                           m => m.command === 'run4');

        expect(idx1).to.be(-1);
        expect(idx2).to.be(-1);
        expect(idx3 === -1).to.be(false);
        expect(idx4 === -1).to.be(false);
      });
开发者ID:7125messi,项目名称:jupyterlab,代码行数:21,代码来源:labmenu.spec.ts

示例10: it

 it('adjust after removing the selected item', function() {
     ArrayExt.removeAt(sequence, 1);
     selection.adjustSelectionForRemove(1, 'value-1');
     expect(selection.index).to.equal(0);
     expect(selection.value).to.equal('value-0');
     const message = getLastMessage(subscriber);
     expect(message).to.deep.equal({
         previousIndex: 1,
         previousValue: 'value-1',
         currentIndex: 0,
         currentValue: 'value-0'
     });
 });
开发者ID:SylvainCorlay,项目名称:ipywidgets,代码行数:13,代码来源:currentselection_test.ts


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