本文整理汇总了TypeScript中@nteract/actions.save函数的典型用法代码示例。如果您正苦于以下问题:TypeScript save函数的具体用法?TypeScript save怎么用?TypeScript save使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了save函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: mergeMap
mergeMap((contentRef: ContentRef) => {
const state = state$.value;
const content = selectors.content(state, { contentRef });
let isVisible = false;
// document.hidden appears well supported
if (document.hidden) {
// Opera 12.10 and Firefox 18 and later support
isVisible = !document.hidden;
} else if ((document as any).msHidden) {
isVisible = !(document as any).msHidden;
} else if ((document as any).webkitHidden) {
isVisible = !(document as any).webkitHidden;
} else {
// Final fallback -- this will say the window is hidden when devtools is open or if the
// user is interacting with an iframe
isVisible = document.hasFocus();
}
if (
isVisible &&
// Don't bother saving nothing
content &&
// Only files and notebooks
(content.type === "file" || content.type === "notebook") &&
// Only save if they have a real filepath
content.filepath !== ""
) {
return of(actions.save({ contentRef }));
} else {
return empty();
}
})
开发者ID:kelleyblackmore,项目名称:nteract,代码行数:34,代码来源:contents.ts
示例2: test
test("should set isSaving to true", () => {
const originalState = stateModule.makeAppRecord({
isSaving: false,
kernel: stateModule.makeLocalKernelRecord({
channels: false,
spawn: false,
connectionFile: false
})
});
const state = reducers.app(originalState, actions.save({}));
expect(state.isSaving).toBe(true);
});
开发者ID:kelleyblackmore,项目名称:nteract,代码行数:12,代码来源:app.spec.ts
注:本文中的@nteract/actions.save函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论