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


TypeScript redux-typed.isActionType函数代码示例

本文整理汇总了TypeScript中redux-typed.isActionType函数的典型用法代码示例。如果您正苦于以下问题:TypeScript isActionType函数的具体用法?TypeScript isActionType怎么用?TypeScript isActionType使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: if

export const reducer: Reducer<GenreDetailsState> = (state, action) => {
    if (isActionType(action, RequestGenreDetails)) {
        return { requestedGenreId: action.genreId, albums: [], isLoaded: false };
    } else if (isActionType(action, ReceiveGenreDetails)) {
        return { requestedGenreId: action.genreId, albums: action.albums, isLoaded: true };
    } else {
        return state || { requestedGenreId: null as number, albums: [], isLoaded: false };
    }
};
开发者ID:Naveen-Bhat,项目名称:NodeServices,代码行数:9,代码来源:GenreDetails.ts

示例2: if

export const reducer: Reducer<AlbumDetailsState> = (state, action) => {
    if (isActionType(action, RequestAlbumDetails)) {
        return { requestedAlbumId: action.albumId, album: null };
    } else if (isActionType(action, ReceiveAlbumDetails)) {
        return { requestedAlbumId: action.album.AlbumId, album: action.album };
    } else {
        return state || unloadedState;
    }
};
开发者ID:Naveen-Bhat,项目名称:NodeServices,代码行数:9,代码来源:AlbumDetails.ts

示例3: if

export const reducer: Reducer<UsersState> = (state, action) => {
    if (isActionType(action, UserLoad)) {
        return { isLoading: true, users: state.users, user:state.user };
    } else if (isActionType(action, UserList)) {
            return {users: action.users, user:state.user, isLoading: false };
    }else if (isActionType(action, UserItem)) {
        return {users: state.users, user: action.user, isLoading: false };
    }
    return state || unloadedState;
};
开发者ID:AaronJin2013,项目名称:react-frame-demo,代码行数:10,代码来源:index.ts

示例4:

export const reducer: Reducer<DialogState> = (state, action) => {
    if (isActionType(action, OpenDialog)) {
        return { isOpen: true };
    }

    if (isActionType(action, CloseDialog)) {
        return { isOpen: false };
    }
    
    // For unrecognized actions (or in cases where actions have no effect), must return the existing state
    //  (or default initial state if none was supplied)
    return state || { isOpen: false };
};
开发者ID:skillsacademy,项目名称:SkillsAcademy-Dev,代码行数:13,代码来源:DialogPage.ts

示例5: if

export const reducer: Reducer<AddPollState> = (state, action) => {
  
  if (isActionType(action, AddPoll)) {
    return { success: null, isLoading: true, pollId: state.pollId };
  } else if (isActionType(action, AddPollSuccess)) {
    return { success: true, isLoading: false, pollId: action.details.id };
  } else if (isActionType(action, AddPollFailure)) {
    return { success: false, isLoading: false, pollId: 0 };
  }
  
  // For unrecognized actions (or in cases where actions have no effect), must return the existing state
  // (or default initial state if none was supplied)
  return state || unloadedState;
};
开发者ID:dmayala,项目名称:BallotboxCore,代码行数:14,代码来源:AddPoll.ts

示例6: if

export const reducer: Reducer<WeatherForecastsState> = (state, action) => {
    if (isActionType(action, RequestWeatherForecasts)) {
        return { startDateIndex: action.startDateIndex, isLoading: true, forecasts: state.forecasts };
    } else if (isActionType(action, ReceiveWeatherForecasts)) {
        // Only accept the incoming data if it matches the most recent request. This ensures we correctly
        // handle out-of-order responses.
        if (action.startDateIndex === state.startDateIndex) {
            return { startDateIndex: action.startDateIndex, forecasts: action.forecasts, isLoading: false };
        }
    }
    
    // For unrecognized actions (or in cases where actions have no effect), must return the existing state
    // (or default initial state if none was supplied)
    return state || unloadedState;
};
开发者ID:An0564,项目名称:JavaScriptServices,代码行数:15,代码来源:WeatherForecasts.ts

示例7:

export const reducer: Reducer<GenresListState> = (state, action) => {
    if (isActionType(action, ReceiveGenresList)) {
        return { genres: action.genres, isLoaded: true };
    } else {
        return state || { genres: [], isLoaded: false };
    }
};
开发者ID:Naveen-Bhat,项目名称:NodeServices,代码行数:7,代码来源:GenreList.ts

示例8:

export const reducer: Reducer<FeaturedAlbumsState> = (state, action) => {
    if (isActionType(action, ReceiveFeaturedAlbums)) {
        return { albums: action.albums, isLoaded: true };
    } else {
        return state || { albums: [], isLoaded: false };
    }
};
开发者ID:An0564,项目名称:JavaScriptServices,代码行数:7,代码来源:FeaturedAlbums.ts

示例9:

export const reducer: Reducer<LocationState> = (state, action) => {
    if (isActionType(action, RequestLocation)) {
        return { name: action.location };
    } 

    return state || { name: "" };
};
开发者ID:mikeyjones,项目名称:WeatherTest,代码行数:7,代码来源:Location.ts

示例10:

export const reducer: Reducer<CounterState> = (state, action) => {
    if (isActionType(action, IncrementCount)) {
        return { count: state.count + 1 };
    }
    
    // For unrecognized actions (or in cases where actions have no effect), must return the existing state
    //  (or default initial state if none was supplied)
    return state || { count: 0 };
};
开发者ID:An0564,项目名称:JavaScriptServices,代码行数:9,代码来源:Counter.ts


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