Closed relistan closed 3 years ago
On startup the following code from the README does not work with the current master branch:
README
master
const picker = new ColorPickerControl({ container: document.body, theme: 'light' }); picker.on('init', (instance) => { console.log('Event: "init"', instance); }); picker.on('open', (instance) => { console.log('Event: "open"', instance); }); picker.on('change', (color) => { console.log('Event: "change"', color); }); picker.on('close', (instance) => { console.log('Event: "close"', instance); });
This is because eventListeners[event] is not initialized and so the push operation fails. This change lazily initializes the event type in eventListeners and resolves the issue without having to explicitly initialize each event.
eventListeners[event]
push
eventListeners
On startup the following code from the
README
does not work with the currentmaster
branch:This is because
eventListeners[event]
is not initialized and so thepush
operation fails. This change lazily initializes the event type ineventListeners
and resolves the issue without having to explicitly initialize each event.