本文整理汇总了TypeScript中@nteract/core.selectors.kernelRefByContentRef方法的典型用法代码示例。如果您正苦于以下问题:TypeScript selectors.kernelRefByContentRef方法的具体用法?TypeScript selectors.kernelRefByContentRef怎么用?TypeScript selectors.kernelRefByContentRef使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@nteract/core.selectors
的用法示例。
在下文中一共展示了selectors.kernelRefByContentRef方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: cwdKernelFallback
index => {
if (index === 0) {
const state = store.getState();
const oldKernelRef = selectors.kernelRefByContentRef(state, ownProps);
if (!oldKernelRef) {
console.error("kernel not available for relaunch");
return;
}
const kernel = selectors.kernel(state, { kernelRef: oldKernelRef });
if (!kernel) {
console.error("kernel not available for relaunch");
return;
}
const cwd = filepath
? path.dirname(path.resolve(filepath))
: cwdKernelFallback();
// Create a brand new kernel
const kernelRef = createKernelRef();
store.dispatch(
actions.launchKernelByName({
kernelSpecName: kernel.kernelSpecName,
cwd,
selectNextKernel: true,
kernelRef,
contentRef: ownProps.contentRef
})
);
}
resolve();
}
示例2: dispatchKillKernel
export function dispatchKillKernel(
ownProps: { contentRef: ContentRef },
store: DesktopStore
) {
const state = store.getState();
const kernelRef = selectors.kernelRefByContentRef(state, ownProps);
if (!kernelRef) {
store.dispatch(actions.coreError(new Error("kernel not set")));
return;
}
store.dispatch(actions.killKernel({ restarting: false, kernelRef }));
}
示例3: dispatchRestartKernel
export function dispatchRestartKernel(
ownProps: { contentRef: ContentRef },
store: DesktopStore,
outputHandling: actions.RestartKernelOutputHandling
) {
const state = store.getState();
const kernelRef = selectors.kernelRefByContentRef(state, ownProps);
if (!kernelRef) {
store.dispatch(actions.coreError(new Error("kernel not set")));
return;
}
store.dispatch(
actions.restartKernel({
outputHandling,
kernelRef,
contentRef: ownProps.contentRef
})
);
}
示例4: dispatchInterruptKernel
export function dispatchInterruptKernel(
ownProps: { contentRef: ContentRef },
store: DesktopStore
) {
const state = store.getState();
const notificationSystem = selectors.notificationSystem(state);
if (process.platform === "win32") {
notificationSystem.addNotification({
title: "Not supported in Windows",
message: "Kernel interruption is not supported in Windows.",
level: "error"
});
} else {
const kernelRef = selectors.kernelRefByContentRef(state, ownProps);
if (!kernelRef) {
store.dispatch(actions.coreError(new Error("kernel not set")));
return;
}
store.dispatch(actions.interruptKernel({ kernelRef }));
}
}