本文整理汇总了TypeScript中@nteract/core.selectors.notificationSystem方法的典型用法代码示例。如果您正苦于以下问题:TypeScript selectors.notificationSystem方法的具体用法?TypeScript selectors.notificationSystem怎么用?TypeScript selectors.notificationSystem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@nteract/core.selectors
的用法示例。
在下文中一共展示了selectors.notificationSystem方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: map
map(() => {
if (process.platform !== "darwin") {
const notificationSystem = selectors.notificationSystem(
state$.value
);
notificationSystem.addNotification({
autoDismiss: 2,
level: "success",
title: "Save successful!"
});
}
return actions.saveFulfilled({
contentRef: action.payload.contentRef,
model: {
last_modified: new Date()
}
});
}),
示例2: catch
remote.ipcMain.on("auth", (_event: Event, auth: string) => {
try {
const accessToken = JSON.parse(auth).access_token;
store.dispatch(actions.setGithubToken(accessToken));
const notificationSystem = selectors.notificationSystem(state);
notificationSystem.addNotification({
title: "Authenticated",
message: "ðŸââ",
level: "info"
});
// We are now authenticated and can finally publish
store.dispatch(actions.publishGist(ownProps));
} catch (e) {
store.dispatch(actions.coreError(e));
} finally {
win.close();
}
});
示例3: 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 }));
}
}
示例4: mergeMap
mergeMap(xhr => {
const notificationSystem = selectors.notificationSystem(state$.value);
const { id, login } = xhr.response;
// NOTE: One day we need to make this part of our proper store
// instead of hidden side effects
notificationSystem.addNotification({
title: "Gist uploaded",
message: "đ đ˘",
dismissible: true,
position: "tr",
level: "success",
action: {
label: "Open Gist",
callback() {
shell.openExternal(`https://nbviewer.jupyter.org/${id}`);
}
}
});
// TODO: Turn this into one action that does both, even if its
// sometimes a no-op
return of(
actions.overwriteMetadataField({
field: "github_username",
value: login,
contentRef
}),
actions.overwriteMetadataField({
field: "gist_id",
value: id,
contentRef
})
);
}),