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


TypeScript algorithm.each函数代码示例

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


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

示例1: toggleAllLineNumbers

 function toggleAllLineNumbers(widget: Notebook): void {
   if (!widget.model || !widget.activeCell) {
     return;
   }
   let lineNumbers = widget.activeCell.editor.lineNumbers;
   each(widget.widgets, child => {
     child.editor.lineNumbers = !lineNumbers;
   });
 }
开发者ID:rlugojr,项目名称:jupyterlab,代码行数:9,代码来源:actions.ts

示例2: it

 it('should insert a widget into the tab panel at a specified index', () => {
   let panel = new TabPanel();
   let widgets = [new Widget(), new Widget(), new Widget()];
   each(widgets, w => { panel.addWidget(w); });
   let widget = new Widget();
   panel.insertWidget(1, widget);
   expect(panel.widgets[1]).to.equal(widget);
   expect(panel.tabBar.titles[1]).to.equal(widget.title);
 });
开发者ID:afshin,项目名称:phosphor,代码行数:9,代码来源:tabpanel.spec.ts

示例3: it

 it('should add a class name to the flex panel children', () => {
   let p = new FlexPanel();
   p.addWidget(new Widget());
   p.addWidget(new Widget());
   p.addWidget(new Widget());
   each(p.widgets, (child) => {
     expect(child.hasClass('p-FlexPanel-child')).to.be(true);
   });
 });
开发者ID:vidartf,项目名称:nbdime,代码行数:9,代码来源:flexpanel.spec.ts

示例4: createFooter

 /**
  * Create the footer of the dialog.
  *
  * @param buttonNodes - The buttons nodes to add to the footer.
  *
  * @returns A widget for the footer.
  */
 createFooter(buttons: ReadonlyArray<HTMLElement>): Widget {
   let footer = new Widget();
   footer.addClass('jp-Dialog-footer');
   each(buttons, button => {
     footer.node.appendChild(button);
   });
   Styling.styleNode(footer.node);
   return footer;
 }
开发者ID:cameronoelsen,项目名称:jupyterlab,代码行数:16,代码来源:dialog.ts

示例5: runAll

 function runAll(widget: Notebook, kernel?: Kernel.IKernel): Promise<boolean> {
   if (!widget.model || !widget.activeCell) {
     return Promise.resolve(false);
   }
   each(widget.widgets, child => {
     widget.select(child);
   });
   return run(widget, kernel);
 }
开发者ID:rlugojr,项目名称:jupyterlab,代码行数:9,代码来源:actions.ts

示例6: clearAllOutputs

 function clearAllOutputs(widget: Notebook): void {
   if (!widget.model || !widget.activeCell) {
     return;
   }
   each(widget.model.cells, (cell: ICodeCellModel) => {
     if (cell.type === 'code') {
       cell.outputs.clear();
       cell.executionCount = null;
     }
   });
 }
开发者ID:rlugojr,项目名称:jupyterlab,代码行数:11,代码来源:actions.ts

示例7: toggleAllLineNumbers

 function toggleAllLineNumbers(widget: Notebook): void {
   if (!widget.model || !widget.activeCell) {
     return;
   }
   let state = Private.getState(widget);
   let lineNumbers = widget.activeCell.editor.lineNumbers;
   each(widget.widgets, child => {
     child.editor.lineNumbers = !lineNumbers;
   });
   Private.handleState(widget, state);
 }
开发者ID:eskirk,项目名称:jupyterlab,代码行数:11,代码来源:actions.ts

示例8: it

 it('should break early if the callback returns `false`', () => {
   let result = 0;
   let data = [1, 2, 3, 4, 5];
   each(data, x => {
     if (x > 3) {
       return false;
     }
     result += x;
     return true;
   });
   expect(result).to.equal(6);
 });
开发者ID:afshin,项目名称:phosphor,代码行数:12,代码来源:iter.spec.ts

示例9: each

 execute: () => {
   const promises: Promise<void>[] = [];
   const paths = new Set<string>(); // Cache so we don't double save files.
   each(shell.widgets('main'), widget => {
     const context = docManager.contextForWidget(widget);
     if (context && !context.model.readOnly && !paths.has(context.path)) {
       paths.add(context.path);
       promises.push(context.save());
     }
   });
   return Promise.all(promises);
 }
开发者ID:afshin,项目名称:jupyterlab,代码行数:12,代码来源:index.ts


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