OutlawPlz / droppy

Pure JavaScript multi-level drop-down menu.
GNU General Public License v3.0
8 stars 0 forks source link

Simplify object passed to events #5

Open OutlawPlz opened 6 years ago

OutlawPlz commented 6 years ago

When an event is dispatched, in the event object there is the Riccio instance and the DroppyNode that relative to the clicked drop-down.

// Print Droppy and DroppyNode instance.
droppy.on('open', function handler (event) {
  console.log(event.droppy)
  console.log(event.dropdown)
})

However the Droppy instance may be bind to the handler function as contenxt.

// Bind Droppy instance as context.
droppy.on('open', function handler (event) {}, droppy)

This turns useless have the Droppy instance in the event object. Furthermore the handler function has access to the droppy variable from its scope. Should I remove the Droppy instance from the event object?