本文整理汇总了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();
}
})
示例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);
});