escalade-price-store
Version:
An event-based store system for getting Escalade Sports pricing. Stores all fetched prices in a cookie for quick retrieval.
37 lines (34 loc) • 1.1 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = triggerChange;
function triggerChange() {
var _this = this;
var id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
this.log("Triggering any changes...");
this.changeEventsOptions.forEach(function (opt, key) {
if (id !== false) {
id = id.toLowerCase();
if (opt.id === id) {
if (opt.formatted) {
_this.log("Triggering change for " + id + ": formatted price");
_this.changeEvents[key](_this.getFormattedPrice(id));
} else {
_this.log("Triggering change for " + id + ": unformatted price");
_this.changeEvents[key](_this.getPrice(id));
}
}
} else if (opt.id === false) {
if (opt.formatted) {
_this.log("Triggering change for all: formatted price");
_this.changeEvents[key](_this.getFormattedPrices());
} else {
_this.log("Triggering change for all: unformatted price");
_this.changeEvents[key](_this.getPrices());
}
}
});
}
module.exports = exports["default"];
//# sourceMappingURL=trigger-change.js.map