Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

'onStop' not declared locally, JSHint failing #1

Merged
merged 2 commits into from
May 22, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions src/sortable.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ angular.module('ui.sortable', []).value('uiSortableConfig',{}).directive('uiSort
return {
require: '?ngModel',
link: function(scope, element, attrs, ngModel) {
var onReceive, onRemove, onStart, onUpdate, opts;
var onStart, onUpdate, onReceive, onRemove, onStop, opts;

opts = angular.extend({}, uiSortableConfig, scope.$eval(attrs.uiSortable));

Expand Down Expand Up @@ -65,44 +65,49 @@ angular.module('ui.sortable', []).value('uiSortableConfig',{}).directive('uiSort
opts.start = (function(_start){
return function(e, ui) {
onStart(e, ui);
if (typeof _start === "function")
if ( typeof _start === "function") {
_start(e, ui);
}
}
};
})(opts.start);

// If user provided 'start' callback compose it with onStart function
// If user provided 'stop' callback compose it with onStop function
opts.stop = (function(_stop){
return function(e, ui) {
onStop(e, ui);
if (typeof _stop === "function")
if (typeof _stop === "function") {
_stop(e, ui);
}
}
};
})(opts.stop);

// If user provided 'update' callback compose it with onUpdate function
opts.update = (function(_update){
return function(e, ui) {
onUpdate(e, ui);
if (typeof _update === "function")
if (typeof _update === "function") {
_update(e, ui);
}
}
};
})(opts.update);

// If user provided 'receive' callback compose it with onReceive function
opts.receive = (function(_receive){
return function(e, ui) {
onReceive(e, ui);
if (typeof _receive === "function")
if (typeof _receive === "function") {
_receive(e, ui);
}
}
};
})(opts.receive);

// If user provided 'remove' callback compose it with onRemove function
opts.remove = (function(_remove){
return function(e, ui) {
onRemove(e, ui);
if (typeof _remove === "function")
if (typeof _remove === "function") {
_remove(e, ui);
}
};
})(opts.remove);
}
Expand Down