0
我剛剛使用流量並開始使用alt.js implmentation。我想知道我什麼時候會在我的動作中使用dispatch。例如,拿這個代碼。什麼時候使用alt.js流量
//ImageActions.js
class ImageActions {
getImages(id) {
return Api.get(`topics/${id}`).then(response => {
let images = response.data.filter(image => {
return !image.is_album;
});
this.updateImages(images);
});
}
updateImages(images) {
return images;
}
}
---------------------------------------------------
//ImageStore.js
class ImageStore {
constructor() {
this.images = [];
this.image = {};
this.bindListeners({
handleUpdateImages: ImageActions.UPDATE_IMAGES
});
}
handleUpdateImages(images) {
this.images = images;
}
}
目前這個工作沒有使用調度()函數,在這裏他們的教程http://alt.js.org/guide/async/
我不知道什麼時候我會想這樣做,做什麼調度和它做什麼比看到不同只是返回ImageaActions.js中updateImages函數的值