當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。