Skip to content

Commit 4f4b045

Browse files
author
daniel-lundin
committed
Fixed UMD-build, fixed cancelling animations
1 parent 3cd7803 commit 4f4b045

File tree

8 files changed

+114
-63
lines changed

8 files changed

+114
-63
lines changed

docs/snabbt.min.js

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"watch": "watchify -v -t babelify src/main.js -o snabbt.js",
1616
"test": "mocha src/**/*Tests.js --harmony",
1717
"tdd": "mocha src/**/*Tests.js --harmony --watch",
18-
"build": "browserify -t babelify src/main.js -o snabbt.js && uglifyjs --compress --mangle -- snabbt.js > snabbt.min.js",
18+
"build": "browserify -s snabbt -t babelify src/main.js -o snabbt.js && uglifyjs --compress --mangle -- snabbt.js > snabbt.min.js",
1919
"bannerify": "cat snabbt.js > /tmp/snabbt.js && node banner.js > snabbt.js && cat /tmp/snabbt.js >> snabbt.js && cat snabbt.min.js > /tmp/snabbt.min.js && node banner.js > snabbt.min.js && cat /tmp/snabbt.min.js >> snabbt.min.js",
2020
"release": "npm run build && npm run bannerify"
2121
},
@@ -32,6 +32,7 @@
3232
"mocha": "^2.3.3",
3333
"moment": "^2.10.6",
3434
"sinon": "^1.17.1",
35+
"uglify": "^0.1.5",
3536
"watchify": "^3.4.0"
3637
},
3738
"spm": {

snabbt.js

Lines changed: 40 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
/* snabbt.js Version: 0.6.0 Build date: 2015-12-11 (c) 2015 Daniel Lundin @license MIT */
2-
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
1+
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.snabbt = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
32
'use strict';
43
var utils = require('./utils.js');
54
var easing = require('./easing.js');
@@ -447,7 +446,7 @@ var Engine = {
447446
var completeCallback = animation[1].options.complete;
448447
if (completeCallback) completeCallback();
449448
});
450-
//this.clearOphanedEndStates();
449+
this.clearOphanedEndStates();
451450
},
452451

453452
createQueuedAnimations: function createQueuedAnimations(finished) {
@@ -484,6 +483,10 @@ var Engine = {
484483
var startState = stateFromOptions(options, previousState, true);
485484
var endState = stateFromOptions(options, previousState, false);
486485

486+
this.runningAnimations = this.runningAnimations.filter(function (animation) {
487+
var animationElement = animation[0];
488+
return element !== animationElement;
489+
});
487490
var animation = Animation.createAnimation(startState, endState, options, this.transformProperty);
488491
return animation;
489492
},
@@ -543,6 +546,8 @@ module.exports = Engine;
543546
var Engine = require('./engine.js');
544547
var preprocessOptions = require('./properties.js').preprocessOptions;
545548
var utils = require('./utils.js');
549+
var createMatrix = require('./matrix.js');
550+
var updateElementTransform = require('./utils.js').updateElementTransform;
546551

547552
function snabbt(elements, arg2, arg3) {
548553
if (!elements.length) {
@@ -591,27 +596,41 @@ function snabbt(elements, arg2, arg3) {
591596
return aggregateChainer;
592597
}
593598

594-
if (typeof window !== 'undefined') {
595-
window.snabbt = function (element, arg2, arg3) {
596-
return snabbt(element, arg2, arg3);
597-
};
599+
//if (typeof window !== 'undefined') {
600+
// window.snabbt = function(element, arg2, arg3) {
601+
// return snabbt(element, arg2, arg3);
602+
// };
603+
// window.snabbt.createMatrix = createMatrix;
604+
// window.snabbt.setElementTransform = updateElementTransform;
605+
//
606+
// if (window.jQuery) {
607+
// (function ($) {
608+
// $.fn.snabbt = function(arg1, arg2) {
609+
// return snabbt(this.get(), arg1, arg2);
610+
// };
611+
// })(window.jQuery);
612+
// }
613+
//} else {
614+
615+
module.exports = function (element, arg2, arg3) {
616+
return snabbt(element, arg2, arg3);
617+
};
618+
module.exports.createMatrix = createMatrix;
619+
module.exports.setElementTransform = updateElementTransform;
598620

599-
if (window.jQuery) {
600-
(function ($) {
601-
$.fn.snabbt = function (arg1, arg2) {
602-
return snabbt(this.get(), arg1, arg2);
603-
};
604-
})(window.jQuery);
605-
}
606-
} else {
607-
module.exports.snabbt = function (element, arg2, arg3) {
608-
return snabbt(element, arg2, arg3);
609-
};
621+
if (typeof window !== 'undefined' && window.jQuery) {
622+
(function ($) {
623+
$.fn.snabbt = function (arg1, arg2) {
624+
return snabbt(this.get(), arg1, arg2);
625+
};
626+
})(window.jQuery);
610627
}
611628

629+
//}
630+
612631
Engine.init();
613632

614-
},{"./engine.js":3,"./properties.js":6,"./utils.js":9}],5:[function(require,module,exports){
633+
},{"./engine.js":3,"./matrix.js":5,"./properties.js":6,"./utils.js":9}],5:[function(require,module,exports){
615634
'use strict';
616635

617636
function assignedMatrixMultiplication(a, b, res) {
@@ -1239,4 +1258,5 @@ module.exports = {
12391258
findUltimateAncestor: findUltimateAncestor
12401259
};
12411260

1242-
},{}]},{},[4]);
1261+
},{}]},{},[4])(4)
1262+
});

0 commit comments

Comments
 (0)