parallax / ddt

DDT (Drag and Drop Tables) is a library that adds drag and drop reordering support to HTML tables.
MIT License
5 stars 0 forks source link

New event syntax #39

Closed nathggns closed 10 years ago

nathggns commented 10 years ago

Currently we listen to events like this

table.emitter.on('ddt.order', function(order) {
    // order
});

This is the syntax that I think would work better

table.on('reorder', function(order) {
    // order
});

This would mean that DragAndDropTable would have to inherit from eventEmitter (which is fine, TypeScript should take care of that for us). We'd also have to drop the 'ddt.' prefix from our events, and rename the following events.

 - ddt.order => reorder
nathggns commented 10 years ago

@MrRio What do you think?

MrRio commented 10 years ago

@nathggns Nice, does the 'order' argument need to be passed in for the new syntax

nathggns commented 10 years ago

Ah yes, sorry I forgot to include that. I'll implement this now then.

nathggns commented 10 years ago

This will only affect events on the DragAndDropTable class, and not the events on the DDTElement class and its subclasses. We will still use an emitter property for those. However, it will still be nice to remove the ddt. prefix from those events. That means the following events need to be rename.

ddt.position => position