本文整理汇总了TypeScript中camelot-unchained.utils.createReducer方法的典型用法代码示例。如果您正苦于以下问题:TypeScript utils.createReducer方法的具体用法?TypeScript utils.createReducer怎么用?TypeScript utils.createReducer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类camelot-unchained.utils
的用法示例。
在下文中一共展示了utils.createReducer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: channelToPatcherServer
// create a server for this channel
channelServers[c.channelName] = channelToPatcherServer(c);
let lastUpdated = localStorage.getItem(`channel_updated_${c.channelName}`);
if (lastUpdated) {
channelServers[c.channelName].lastUpdated = lastUpdated;
}
} else {
// if it's not it's own server add to a dictionary to update servers by channel id
channelDict[c.channelID] = c;
// while we're here lets see if we need to update the last updated time
if (state.servers[c.channelName].channelStatus === ChannelStatus.Updating && c.channelStatus === ChannelStatus.Ready) {
localStorage.setItem(`channel_updated_${c.channelName}`, action.when.toLocaleString());
}
}
}
const servers = utils.clone(state.servers);
for (const server in servers) {
var s = servers[server];
servers[server].channelStatus = channelDict[s.channelID] ? channelDict[s.channelID].channelStatus : ChannelStatus.NotInstalled;
servers[server].lastUpdated = channelDict[s.channelID] ? localStorage.getItem(`channel_updated_${channelDict[s.channelID].channelName}`) : undefined;
}
return utils.merge(state, {
servers: utils.merge(servers, channelServers)
});
}
export default utils.createReducer<ControllerState>(initialState(), actionDefs);