Skip to content

Commit

Permalink
add AMD support; fixes #6
Browse files Browse the repository at this point in the history
tick version
  • Loading branch information
desandro committed May 3, 2013
1 parent 605771e commit 770e76d
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 16 deletions.
5 changes: 4 additions & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
"devel": true,
"strict": true,
"undef": true,
"unused": true
"unused": true,
"predef": {
"define": false
}
}
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "draggabilly",
"main": "./draggabilly.js",
"version": "1.0.1",
"main": "draggabilly.js",
"version": "1.0.2",
"dependencies": {
"classie": "desandro/classie",
"eventEmitter": ">=3",
Expand Down
45 changes: 32 additions & 13 deletions draggabilly.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Draggabilly v1.0.1
* Draggabilly v1.0.2
* Make that shiz draggable
* http://draggabilly.desandro.com
*/
Expand All @@ -8,13 +8,7 @@

'use strict';

// dependencies
var classie = window.classie;
var EventEmitter = window.EventEmitter;
var eventie = window.eventie;
var getStyleProperty = window.getStyleProperty;
var getSize = window.getSize;

// vars
var document = window.document;

// -------------------------- helpers -------------------------- //
Expand Down Expand Up @@ -88,6 +82,10 @@ if ( !requestAnimationFrame || !cancelAnimationFrame ) {
};
}

// -------------------------- definition -------------------------- //

function draggabillyDefinition( classie, EventEmitter, eventie, getStyleProperty, getSize ) {

// -------------------------- support -------------------------- //

var transformProperty = getStyleProperty('transform');
Expand Down Expand Up @@ -441,10 +439,31 @@ Draggabilly.prototype.disable = function() {
}
};

// -------------------------- -------------------------- //


// publicize
window.Draggabilly = Draggabilly;
return Draggabilly;

} // end definition

// -------------------------- transport -------------------------- //

if ( typeof define === 'function' && define.amd ) {
// AMD
define( [
'classie',
'eventEmitter',
'eventie',
'get-style-property',
'get-size'
],
draggabillyDefinition );
} else {
// browser global
window.Draggabilly = draggabillyDefinition(
window.classie,
window.EventEmitter,
window.eventie,
window.getStyleProperty,
window.getSize
);
}

})( window );

0 comments on commit 770e76d

Please sign in to comment.