January 2020
Intermediate to advanced
548 pages
13h 36m
English
The Conventional Module pattern is usually expressed as a plain object literal with a set of methods:
const timeDiffUtility = { minutesBetween(dateA, dateB) {}, hoursBetween(dateA, dataB) {}, daysBetween(dateA, dateB) {}};
It's quite typical for such a module to also reveal specific initialization methods such as initialize, init, or setup. Alternatively, we may want to provide methods that change the state or configuration of the entire module (such as setConfig):
const timeDiffUtility = { setConfig(config) { this.config = config; }, minutesBetween(dateA, dateB) {}, hoursBetween(dateA, dataB) {}, daysBetween(dateA, dateB) {}};
The Conventional Module pattern is incredibly flexible since it is just a plain ...
Read now
Unlock full access