当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript selectors.notificationSystem方法代码示例

本文整理汇总了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()
     }
   });
 }),
开发者ID:nteract,项目名称:nteract,代码行数:18,代码来源:saving.ts

示例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();
        }
      });
开发者ID:nteract,项目名称:nteract,代码行数:21,代码来源:menu.ts

示例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 }));
  }
}
开发者ID:nteract,项目名称:nteract,代码行数:23,代码来源:menu.ts

示例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
            })
          );
        }),
开发者ID:nteract,项目名称:nteract,代码行数:36,代码来源:github-publish.ts


注:本文中的@nteract/core.selectors.notificationSystem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。