本文整理汇总了TypeScript中@webapp/store.dispatch函数的典型用法代码示例。如果您正苦于以下问题:TypeScript dispatch函数的具体用法?TypeScript dispatch怎么用?TypeScript dispatch使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dispatch函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: getUserProfileStatusById
users.on('patched', (profile) => {
const status = getUserProfileStatusById(store.getState(), profile.id);
if (status !== AsyncStatus.NOT_STARTED) {
store.dispatch({
type: UserProfileActionTypes.UPDATE,
payload: { profile },
});
}
});
示例2: getCurrentUserId
.on('patched', (settings) => {
const userId = getCurrentUserId(store.getState());
if (settings.id === userId) {
store.dispatch({
type: SettingsActionTypes.UPDATE,
payload: { settings },
});
}
});
示例3: getUserStatusById
.on('patched', (user) => {
const status = getUserStatusById(store.getState(), user.id);
// If we have already loaded the user, we update the data
if (status !== AsyncStatus.NOT_STARTED) {
store.dispatch({
type: UsersActionTypes.UPDATE,
payload: { user },
});
}
});
示例4: getIdForPlayer
.on('removed', (player) => {
const id = getIdForPlayer(player);
if (id === null) {
return;
}
store.dispatch({
type: PickupPlayerActionTypes.REMOVE_PLAYER,
payload: {
id,
playerId: player.id,
},
});
});
示例5:
.on('patched', (queue) => {
store.dispatch({
type: QueueActionTypes.UPDATE,
payload: { queue },
});
});