ChrisGaudreau
Joined 12 years ago
Karma
298
Submissions
95
Member since
Mar 21
Joined 12 years ago
Classes aren't great either, but at least using class inheritance makes you feel icky, you're not likely to have shared state on the prototype being randomly mutated, and it's pretty readable.
function addObserver(observer, func, { weak = false } = {}) {
if (weak) {
// ...
}
}
addObserver(observer, 'load', { weak: true });