Make size busting also implicitly bust the cache

master
Sven Slootweg 7 years ago
parent b28c927d81
commit 3d5aac5c96

@ -23,8 +23,13 @@ module.exports = function createObject(options) {
originY: "top",
opacity: 1,
bustCache: function bustCache() {
this.emit("bustedCache");
this.isCached = false;
},
bustSize: function bustSize() {
this.emit("bustedSize");
this.recalculateSize();
},
set: function setProperties(properties) {
let transformedProperties;
@ -37,13 +42,13 @@ module.exports = function createObject(options) {
Object.assign(this, transformedProperties);
if (Object.keys(transformedProperties).some(property => this.sizeBustingProperties.includes(property))) {
this.emit("bustedSize");
this.recalculateSize();
/* If the size changes, the cache should also be implicitly busted. */
this.bustSize();
this.bustCache();
}
if (Object.keys(transformedProperties).some(property => this.cacheBustingProperties.includes(property))) {
this.emit("bustedCache");
this.isCached = false;
this.bustCache();
}
},
render: function renderObject(context, options = {}) {

Loading…
Cancel
Save