I've noticed that this code does not work as I expected.
Message RENDER_IMAGE is broadcasted multiple times with different image in payload, but self.model.get("image") in code below always returns last image. Why?
bus.subscribe("RENDER_IMAGE", (message, payload) => {
const self = this;
self.model.set(payload);
self.render().then(function() {
bus.broadcast("IMAGE_RENDER_COMPLETE", self.model.get("image"));
});
});
Meanwhile this code works correct:
bus.subscribe("RENDER_IMAGE", (message, payload) => {
const self = this;
self.model.set(payload);
const image = self.model.get("image"));
self.render().then(function() {
bus.broadcast("IMAGE_RENDER_COMPLETE", image;
});
});