本文整理匯總了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 },
});
});