本文整理匯總了TypeScript中@jupyterlab/apputils/src.CommandLinker.connectNode方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript CommandLinker.connectNode方法的具體用法?TypeScript CommandLinker.connectNode怎麽用?TypeScript CommandLinker.connectNode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@jupyterlab/apputils/src.CommandLinker
的用法示例。
在下文中一共展示了CommandLinker.connectNode方法的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();
});