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