Skip to content

Commit 438febb

Browse files
Make sortable a dependency
1 parent e8df8dc commit 438febb

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
"test": "test"
1818
},
1919
"dependencies": {
20-
"lodash": "^4.13.1"
20+
"lodash": "^4.13.1",
21+
"Sortable": "^1.4.2"
2122
},
2223
"devDependencies": {
2324
"bower": "^1.7.9",

src/vuedragablefor.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
(function(){
2-
function buildVueDragFor(_){
2+
function buildVueDragFor(_, Sortable){
33

44
function mix(source, functions){
55
_.forEach(['bind', 'update', 'unbind'],function(value){
@@ -40,7 +40,7 @@
4040
});
4141
var parent = (!!this.params.root) ? document.getElementById(this.params.root) : this.el.parentElement;
4242
parent.__directive = this;
43-
this.sortable = new Sortable(parent, options);
43+
this._sortable = new Sortable(parent, options);
4444
},
4545
update : function (value){
4646
if ((!!value) && (!Array.isArray(value)))
@@ -49,7 +49,7 @@
4949
this.collection = value;
5050
},
5151
unbind : function (){
52-
this.sortable.destroy();
52+
this._sortable.destroy();
5353
}
5454
});
5555

@@ -61,11 +61,12 @@
6161

6262
if (typeof exports == "object") {
6363
var _ = require("lodash.js");
64-
module.exports = buildVueDragFor(_);
64+
var Sortable = require("Sortable.js");
65+
module.exports = buildVueDragFor(_, Sortable);
6566
} else if (typeof define == "function" && define.amd) {
66-
define(['lodash'], function(_){ return buildVueDragFor(_); });
67-
} else if ((window.Vue) && (window._)) {
68-
window.vueDragFor = buildVueDragFor(window._);
67+
define(['lodash', 'Sortable'], function(_, Sortable){ return buildVueDragFor(_, Sortable; });
68+
} else if ((window.Vue) && (window._) && (window.Sortable)) {
69+
window.vueDragFor = buildVueDragFor(window._, window.Sortable);
6970
Vue.use(window.vueDragFor);
7071
}
7172
})();

0 commit comments

Comments
 (0)