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


TypeScript CommandRegistry.notifyCommandChanged方法代码示例

本文整理汇总了TypeScript中@phosphor/commands.CommandRegistry.notifyCommandChanged方法的典型用法代码示例。如果您正苦于以下问题:TypeScript CommandRegistry.notifyCommandChanged方法的具体用法?TypeScript CommandRegistry.notifyCommandChanged怎么用?TypeScript CommandRegistry.notifyCommandChanged使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在@phosphor/commands.CommandRegistry的用法示例。


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

示例1: it

      it('should update the node content on command change event', async () => {
        const id = 'to-be-removed';
        let iconClassValue: string | null = null;
        const cmd = commands.addCommand(id, {
          execute: () => {
            /* no op */
          },
          label: 'Label-only button',
          iconClass: () => iconClassValue
        });
        const button = new CommandToolbarButton({
          commands,
          id
        });
        await render(button);
        const buttonNode = button.node.firstChild as HTMLButtonElement;
        expect(buttonNode.textContent).to.equal('Label-only button');
        expect(buttonNode.classList.contains(iconClassValue)).to.equal(false);

        iconClassValue = 'updated-icon-class';
        commands.notifyCommandChanged(id);
        await render(button);
        const wrapperNode = buttonNode.firstChild as HTMLElement;
        const iconNode = wrapperNode.firstChild as HTMLElement;
        expect(iconNode.classList.contains(iconClassValue)).to.equal(true);

        cmd.dispose();
      });
开发者ID:afshin,项目名称:jupyterlab,代码行数:28,代码来源:toolbar.spec.ts

示例2: it

 it('should be emitted when a command is changed', () => {
   let called = false;
   registry.addCommand('test', NULL_COMMAND);
   registry.commandChanged.connect((reg, args) => {
     expect(reg).to.equal(registry);
     expect(args.id).to.equal('test');
     expect(args.type).to.equal('changed');
     called = true;
   });
   registry.notifyCommandChanged('test');
   expect(called).to.equal(true);
 });
开发者ID:afshin,项目名称:phosphor,代码行数:12,代码来源:index.spec.ts

示例3: NotebookSearchProvider

 execute: () => {
   if (searchInstance) {
     searchInstance.focusInput();
     return;
   }
   const provider = new NotebookSearchProvider();
   searchInstance = new SearchInstance(nbWidget, provider);
   searchInstance.disposed.connect(() => {
     searchInstance = undefined;
     // find next and previous are now not enabled
     commands.notifyCommandChanged();
   });
   // find next and previous are now enabled
   commands.notifyCommandChanged();
   searchInstance.focusInput();
 }
开发者ID:jupyter,项目名称:jupyterlab,代码行数:16,代码来源:commands.ts

示例4: expect

 expect(() => {
   registry.notifyCommandChanged('foo');
 }).to.throw(Error);
开发者ID:afshin,项目名称:phosphor,代码行数:3,代码来源:index.spec.ts

示例5:

 tracker.currentChanged.connect(() => {
   if (tracker.size <= 1) {
     commands.notifyCommandChanged(CommandIDs.zoomIn);
   }
 });
开发者ID:cameronoelsen,项目名称:jupyterlab,代码行数:5,代码来源:index.ts

示例6:

 searchInstance.disposed.connect(() => {
   searchInstance = undefined;
   // find next and previous are now not enabled
   commands.notifyCommandChanged();
 });
开发者ID:jupyter,项目名称:jupyterlab,代码行数:5,代码来源:commands.ts


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