Browse Source

Allow event functions to be defined as functions AND strings.

The current behavior (in `master`) is to define the handling functions for events as strings. Default for `onSort` for example is `handleSort`. Commit 8cef762d11 changed this behavior forcing handling functions to be defined as functions in the options. This breaks all existing code, resulting in a no-op even with the default options (which still define the default handlers as strings).

This commit restores previous behavior AND allows you to define your handlers as functions directly, if you’re so inclined.
pull/727/head
Julien 9 years ago
parent
commit
764b060cbd
  1. 3
      react-sortable-mixin.js

3
react-sortable-mixin.js vendored

@ -87,6 +87,9 @@
emitEvent = function (/** string */type, /** Event */evt) {
var method = options[type];
if (method && typeof method === "string") {
method = this[method];
}
method && typeof method === "function" && method.call(this, evt, this._sortableInstance);
}.bind(this);

Loading…
Cancel
Save