本文整理汇总了TypeScript中phosphor/lib/core/messaging.installMessageHook函数的典型用法代码示例。如果您正苦于以下问题:TypeScript installMessageHook函数的具体用法?TypeScript installMessageHook怎么用?TypeScript installMessageHook使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了installMessageHook函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: newIFrame
/**
* Create a new IFrame widget.
*
* #### Notes
* Once layout restoration is fully supported, the hidden state of the IFrame
* widget will be handled by the layout restorer and not by the message hook
* handler in this function.
*/
function newIFrame(id: string): IFrame {
let iframe = new IFrame();
iframe.addClass(HELP_CLASS);
iframe.title.label = 'Help';
iframe.id = id;
// If the help widget is being hidden, remove its state.
installMessageHook(iframe, (iframe: IFrame, msg: Message) => {
if (msg === WidgetMessage.BeforeHide) {
state.remove(key);
}
return true;
});
return iframe;
}
开发者ID:danielballan,项目名称:jupyterlab,代码行数:24,代码来源:plugin.ts
示例2: newIFrame
/**
* Create a new IFrame widget.
*/
function newIFrame(url: string): IFrame {
let iframe = new IFrame();
iframe.addClass(HELP_CLASS);
iframe.title.label = category;
iframe.id = `${namespace}`;
iframe.url = url;
// Add the iframe to the instance tracker.
tracker.add(iframe, { area: 'right' });
// If the help widget visibility changes, update the tracker.
installMessageHook(iframe, (iframe: IFrame, msg: Message) => {
switch (msg) {
case WidgetMessage.AfterShow:
case WidgetMessage.BeforeHide:
// Wait until hide has completed.
requestAnimationFrame(() => { tracker.save(iframe); });
break;
default:
break;
}
return true;
});
return iframe;
}
开发者ID:fperez,项目名称:jupyterlab,代码行数:27,代码来源:plugin.ts
注:本文中的phosphor/lib/core/messaging.installMessageHook函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论