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


TypeScript actions.windClosed方法代码示例

本文整理汇总了TypeScript中common/actions.actions.windClosed方法的典型用法代码示例。如果您正苦于以下问题:TypeScript actions.windClosed方法的具体用法?TypeScript actions.windClosed怎么用?TypeScript actions.windClosed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在common/actions.actions的用法示例。


在下文中一共展示了actions.windClosed方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: t

  nativeWindow.on("close", (e: any) => {
    const rs = store.getState();
    if (wind === "root") {
      const prefs =
        rs.preferences || ({ closeToTray: true } as PreferencesState);

      let { closeToTray } = prefs;
      if (rs.system.macos) {
        closeToTray = true;
      }
      if (env.integrationTests) {
        // always let app close in testing
        closeToTray = false;
      }

      if (store.getState().system.quitting) {
        logger.debug("On window.close: quitting, letting it close");
        return;
      }
      if (closeToTray) {
        logger.debug("On window.close: close to tray enabled");
      } else {
        logger.debug("On window.close: close to tray disabled, quitting!");
        process.nextTick(() => {
          store.dispatch(actions.quit({}));
        });
        return;
      }

      // hide, never destroy
      e.preventDefault();
      nativeWindow.hide();

      if (!prefs.gotMinimizeNotification && !store.getState().system.macos) {
        store.dispatch(
          actions.updatePreferences({
            gotMinimizeNotification: true,
          })
        );

        const i18n = store.getState().i18n;
        store.dispatch(
          actions.notify({
            title: t(i18n, ["notification.see_you_soon.title"]),
            body: t(i18n, ["notification.see_you_soon.message"]),
          })
        );
      }
    } else {
      store.dispatch(actions.windClosed({ wind }));
    }
  });
开发者ID:itchio,项目名称:itch,代码行数:52,代码来源:winds.ts

示例2: function

import { WindsState, Action } from "common/types";
import windReducer from "common/reducers/wind";
import { actions } from "common/actions";
import { omit } from "underscore";

const initialState: WindsState = {};

const windOpenedType = actions.windOpened({} as any).type;
const windClosedType = actions.windClosed({} as any).type;

export default function(state: WindsState, action: Action<any>) {
  if (typeof state === "undefined") {
    return initialState;
  }

  if (action) {
    if (action.type === windOpenedType) {
      const { wind } = action.payload as typeof actions.windOpened["payload"];

      let windState = windReducer(undefined, null);
      windState = windReducer(windState, action);

      return {
        ...state,
        [wind]: windState,
      };
    }

    if (action.type === windClosedType) {
      const { wind } = action.payload as typeof actions.windClosed["payload"];
      return omit(state, wind);
开发者ID:itchio,项目名称:itch,代码行数:31,代码来源:winds.ts

示例3:

 nativeWindow.on("closed", (e: any) => {
   store.dispatch(actions.windClosed({ wind }));
 });
开发者ID:itchio,项目名称:itch,代码行数:3,代码来源:winds.ts


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