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


TypeScript algorithm.map函数代码示例

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


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

示例1: it

 it('should create a reverse iterator over the nodes', () => {
   let list = LinkedList.from([0, 1, 2, 3, 4]);
   let n = find(list.nodes(), n => n.value === 2)!;
   let it1 = new LinkedList.RetroNodeIterator(n);
   let it2 = it1.clone();
   let v1 = map(it1, n => n.value);
   let v2 = map(it2, n => n.value);
   expect(it1.iter()).to.equal(it1);
   expect(it2.iter()).to.equal(it2);
   expect(toArray(v1)).to.deep.equal([2, 1, 0]);
   expect(toArray(v2)).to.deep.equal([2, 1, 0]);
 });
开发者ID:afshin,项目名称:phosphor,代码行数:12,代码来源:linkedlist.spec.ts

示例2: constructor

  /**
   * Create a dialog panel instance.
   *
   * @param options - The dialog setup options.
   */
  constructor(options: Dialog.IOptions={}) {
    super();
    this.addClass('jp-Dialog');
    options = Private.handleOptions(options);
    let renderer = options.renderer;

    this._host = options.host;
    this._defaultButton = options.defaultButton;
    this._buttons = options.buttons;
    this._buttonNodes = toArray(map(this._buttons, button => {
      return renderer.createButtonNode(button);
    }));
    this._primary = (
      options.primaryElement || this._buttonNodes[this._defaultButton]
    );

    let layout = this.layout = new PanelLayout();
    let content = new Panel();
    content.addClass('jp-Dialog-content');
    layout.addWidget(content);

    let header = renderer.createHeader(options.title);
    let body = renderer.createBody(options.body);
    let footer = renderer.createFooter(this._buttonNodes);
    content.addWidget(header);
    content.addWidget(body);
    content.addWidget(footer);
  }
开发者ID:charnpreetsingh185,项目名称:jupyterlab,代码行数:33,代码来源:dialog.ts

示例3: toArray

  node.addEventListener('contextmenu', (event: MouseEvent) => {
    event.preventDefault();
    let path = fbWidget.pathForClick(event) || '';
    let ext = DocumentRegistry.extname(path);
    let factories = registry.preferredWidgetFactories(ext);
    let widgetNames = toArray(map(factories, factory => factory.name));
    let prefix = `${namespace}-contextmenu-${++Private.id}`;
    let openWith: Menu = null;
    if (path && widgetNames.length > 1) {
      let disposables = new DisposableSet();
      let command: string;

      openWith = new Menu({ commands });
      openWith.title.label = 'Open With...';
      openWith.disposed.connect(() => { disposables.dispose(); });

      for (let widgetName of widgetNames) {
        command = `${prefix}:${widgetName}`;
        disposables.add(commands.addCommand(command, {
          execute: () => fbWidget.openPath(path, widgetName),
          label: widgetName
        }));
        openWith.addItem({ command });
      }
    }

    let menu = createContextMenu(fbWidget, openWith);
    menu.open(event.clientX, event.clientY);
  });
开发者ID:samvasko,项目名称:jupyterlab,代码行数:29,代码来源:index.ts

示例4:

    execute: () => {
      const widget = tracker.currentWidget;

      if (!widget) {
        return;
      }

      return Promise.all(toArray(map(widget.selectedItems(), item => {
        return commands.execute('docmanager:open-browser-tab', { path: item.path });
      })));
    },
开发者ID:cfsmile,项目名称:jupyterlab,代码行数:11,代码来源:index.ts

示例5: toArray

    execute: args => {
      const factory = (args['factory'] as string) || void 0;
      const widget = tracker.currentWidget;

      if (!widget) {
        return;
      }

      return Promise.all(
        toArray(
          map(widget.selectedItems(), item => {
            if (item.type === 'directory') {
              return widget.model.cd(item.name);
            }

            return commands.execute('docmanager:open', {
              factory: factory,
              path: item.path
            });
          })
        )
      );
    },
开发者ID:ellisonbg,项目名称:jupyterlab,代码行数:23,代码来源:index.ts

示例6: onBeforeAttach

    protected onBeforeAttach(msg: Message): void {
      // clear the current menu items
      this.clearItems();

      // get the widget factories that could be used to open all of the items
      // in the current filebrowser selection
      let factories = OpenWithMenu._intersection(
        map(tracker.currentWidget.selectedItems(), i => {
          return OpenWithMenu._getFactories(i);
        })
      );

      if (factories) {
        // make new menu items from the widget factories
        factories.forEach(factory => {
          this.addItem({
            args: { factory: factory },
            command: CommandIDs.open
          });
        });
      }

      super.onBeforeAttach(msg);
    }
开发者ID:ellisonbg,项目名称:jupyterlab,代码行数:24,代码来源:index.ts

示例7: constructor

  /**
   * Create a dialog panel instance.
   *
   * @param options - The dialog setup options.
   */
  constructor(options: Partial<Dialog.IOptions<T>>={}) {
    super();
    this.addClass('jp-Dialog');
    let normalized = Private.handleOptions(options);
    let renderer = normalized.renderer;

    this._host = normalized.host;
    this._defaultButton = normalized.defaultButton;
    this._buttons = normalized.buttons;
    this._buttonNodes = toArray(map(this._buttons, button => {
      return renderer.createButtonNode(button);
    }));

    let layout = this.layout = new PanelLayout();
    let content = new Panel();
    content.addClass('jp-Dialog-content');
    layout.addWidget(content);

    this._body = normalized.body;

    let header = renderer.createHeader(normalized.title);
    let body = renderer.createBody(normalized.body);
    let footer = renderer.createFooter(this._buttonNodes);
    content.addWidget(header);
    content.addWidget(body);
    content.addWidget(footer);

    this._primary = this._buttonNodes[this._defaultButton];

    if (options.focusNodeSelector) {
      let el = body.node.querySelector(options.focusNodeSelector);
      if (el) {
        this._primary = el as HTMLElement;
      }
    }
  }
开发者ID:cameronoelsen,项目名称:jupyterlab,代码行数:41,代码来源:dialog.ts

示例8: names

 /**
  * Get an iterator over the ordered toolbar item names.
  *
  * @returns An iterator over the toolbar item names.
  */
 names(): IIterator<string> {
   let layout = this.layout as PanelLayout;
   return map(layout.widgets, widget => {
     return Private.nameProperty.get(widget);
   });
 }
开发者ID:rlugojr,项目名称:jupyterlab,代码行数:11,代码来源:index.ts


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