本文整理匯總了TypeScript中@jupyterlab/apputils/src.CommandLinker類的典型用法代碼示例。如果您正苦於以下問題:TypeScript CommandLinker類的具體用法?TypeScript CommandLinker怎麽用?TypeScript CommandLinker使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了CommandLinker類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it('should disconnect a node from a command', () => {
let called = false;
const command = 'commandlinker:disconnect-node';
const commands = new CommandRegistry();
const linker = new CommandLinker({ commands });
const node = document.createElement('div');
const disposable = commands.addCommand(command, {
execute: () => {
called = true;
}
});
document.body.appendChild(node);
linker.connectNode(node, command, null);
// Make sure connection is working.
expect(called).to.equal(false);
simulate(node, 'click');
expect(called).to.equal(true);
// Reset flag.
called = false;
// Make sure disconnection is working.
linker.disconnectNode(node);
expect(called).to.equal(false);
simulate(node, 'click');
expect(called).to.equal(false);
document.body.removeChild(node);
linker.dispose();
disposable.dispose();
});