Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

new makefile and cleaner organization of files

  • Loading branch information...
commit f841335c565ffb1c718224c6261c14f0dfd304b4 1 parent 89fddeb
@hapticdata authored
View
2  Makefile
@@ -1,6 +1,6 @@
REPORTER ?= list
-all: test build
+all: build test
build-lib:
node tools/concat.js
View
22 animitter.js
@@ -8,12 +8,12 @@
//**_Basic use:_**
//
-// animitter(function(){
+// loop = animitter(function(){
// //do this every time
// if(Math.random() > 0.9) this.complete();
-// });
+// }).start();
-var animitter = (function(){
+(function(){
//utils.js
var utils = (function(){
var module = {}, exports = {};
@@ -459,14 +459,12 @@ var animitter = (function(){
exports.Animator = Animator;
/** @expose */
exports.EventEmitter = EventEmitter;
-
- if( typeof define === 'function' && define['amd']){
- define(function(){ return exports; });
- } else if( typeof window === 'object' ){
- window['animitter'] = exports;
- }
return module.exports;
}());
- return animitter;
-}());
-animitter.version = "0.1.0";
+ animitter.version = "0.1.0";
+ if( typeof define === "function" && define["amd"]){
+ define(function(){ return animitter; });
+ } else if( typeof window === "object" ){
+ window["animitter"] = animitter;
+ }
+}());
View
8 animitter.min.js
@@ -5,7 +5,7 @@ s.prototype.addListener=function(a,c){if("function"!==typeof c)throw Error("addL
this.a[a].length),console.trace()}return this};s.prototype.on=s.prototype.addListener;s.prototype.once=function(a,c){function b(){d.removeListener(a,b);c.apply(this,arguments)}if("function"!==typeof c)throw Error(".once only takes instances of Function");var d=this;b.b=c;d.on(a,b);return this};
s.prototype.removeListener=function(a,c){if("function"!==typeof c)throw Error("removeListener only takes instances of Function");if(!this.a||!this.a[a])return this;var b=this.a[a];if(v(b)){for(var d=-1,i=0,q=b.length;i<q;i++)if(b[i]===c||b[i].b&&b[i].b===c){d=i;break}if(0>d)return this;b.splice(d,1);0===b.length&&delete this.a[a]}else(b===c||b.b&&b.b===c)&&delete this.a[a];return this};
s.prototype.removeAllListeners=function(a){if(0===arguments.length)return this.a={},this;a&&(this.a&&this.a[a])&&(this.a[a]=null);return this};s.prototype.listeners=function(a){this.a||(this.a={});this.a[a]||(this.a[a]=[]);v(this.a[a])||(this.a[a]=[this.a[a]]);return this.a[a]};r=t.exports;
-(function(){function a(a){a=a||{};this.frameCount=0;this.completed=this.animating=g;this.async=a.async===e}var c={},b={};c.exports=b;for(var d="object"===typeof window?this:{},i="undefined"!==typeof h&&h.c?h.c:require("util").c,q="undefined"!==typeof r&&r.EventEmitter?r.EventEmitter:require("events").EventEmitter,w=0,j=["ms","moz","webkit","o"],m=0;m<j.length&&!d.requestAnimationFrame;++m)d.requestAnimationFrame=d[j[m]+"RequestAnimationFrame"],d.cancelAnimationFrame=d[j[m]+"CancelAnimationFrame"]||
-d[j[m]+"CancelRequestAnimationFrame"];d.requestAnimationFrame||(d.requestAnimationFrame=function(a){var b=(new Date).getTime(),c=Math.max(0,16-(b-w)),d=setTimeout(function(){a(b+c)},c);w=b+c;return d});d.cancelAnimationFrame||(d.cancelAnimationFrame=function(a){clearTimeout(a)});j={complete:function(){this.animating=g;this.completed=e;this.stop();this.emit("complete",this);return this},i:function(a){if(a)return this.on("complete",a),this},k:function(a){if(a)return this.on("update",a),this},j:function(a){if(a)return this.on("stop",
-a),this},start:function(a){function c(){var a;f.frameCount++;f.async?(f.emit("update",function(){f.animating=e;c()},f),a=g):(f.emit("update",f),a=e);a&&(f.animating?f.e=d.requestAnimationFrame(c):d.cancelAnimationFrame(f.e))}if(this.animating)return this;this.emit("start",this);b.running+=1;this.animating=e;var f=this;if(void 0!==a)this.on("update",a);c();return this},stop:function(){this.animating=g;b.running-=1;this.emit("stop",this);return this}};i(a,q);for(var x in j)a.prototype[x]=j[x];c.exports=
-b=function(b,c){1===arguments.length&&(c=b,b={});var d=new a(b);if(c)d.on("update",c);return d};b.running=0;b.async=function(a,c){1===arguments.length&&(c=a,a={});a.async=e;return b.create(a,c)};b.create=function(b,c){1===arguments.length&&(c=b,b={});return(new a(b)).start(c)};b.defer=b;b.Animator=a;b.EventEmitter=q;"function"===typeof define&&define.amd?define(function(){return b}):"object"===typeof window&&(window.animitter=b);return c.exports})().version="0.1.0";}());
+var w=function(){function a(a){a=a||{};this.frameCount=0;this.completed=this.animating=g;this.async=a.async===e}var c={},b={};c.exports=b;for(var d="object"===typeof window?this:{},i="undefined"!==typeof h&&h.c?h.c:require("util").c,q="undefined"!==typeof r&&r.EventEmitter?r.EventEmitter:require("events").EventEmitter,x=0,j=["ms","moz","webkit","o"],m=0;m<j.length&&!d.requestAnimationFrame;++m)d.requestAnimationFrame=d[j[m]+"RequestAnimationFrame"],d.cancelAnimationFrame=d[j[m]+"CancelAnimationFrame"]||
+d[j[m]+"CancelRequestAnimationFrame"];d.requestAnimationFrame||(d.requestAnimationFrame=function(a){var b=(new Date).getTime(),c=Math.max(0,16-(b-x)),d=setTimeout(function(){a(b+c)},c);x=b+c;return d});d.cancelAnimationFrame||(d.cancelAnimationFrame=function(a){clearTimeout(a)});j={complete:function(){this.animating=g;this.completed=e;this.stop();this.emit("complete",this);return this},i:function(a){if(a)return this.on("complete",a),this},k:function(a){if(a)return this.on("update",a),this},j:function(a){if(a)return this.on("stop",
+a),this},start:function(a){function c(){var a;f.frameCount++;f.async?(f.emit("update",function(){f.animating=e;c()},f),a=g):(f.emit("update",f),a=e);a&&(f.animating?f.e=d.requestAnimationFrame(c):d.cancelAnimationFrame(f.e))}if(this.animating)return this;this.emit("start",this);b.running+=1;this.animating=e;var f=this;if(void 0!==a)this.on("update",a);c();return this},stop:function(){this.animating=g;b.running-=1;this.emit("stop",this);return this}};i(a,q);for(var y in j)a.prototype[y]=j[y];c.exports=
+b=function(b,c){1===arguments.length&&(c=b,b={});var d=new a(b);if(c)d.on("update",c);return d};b.running=0;b.async=function(a,c){1===arguments.length&&(c=a,a={});a.async=e;return b.create(a,c)};b.create=function(b,c){1===arguments.length&&(c=b,b={});return(new a(b)).start(c)};b.defer=b;b.Animator=a;b.EventEmitter=q;return c.exports}();w.version="0.1.0";"function"===typeof define&&define.amd?define(function(){return w}):"object"===typeof window&&(window.animitter=w);}());
View
8 lib/animitter.js
@@ -185,10 +185,4 @@ exports.defer = exports;
/** @expose */
exports.Animator = Animator;
/** @expose */
-exports.EventEmitter = EventEmitter;
-
-if( typeof define === 'function' && define['amd']){
- define(function(){ return exports; });
-} else if( typeof window === 'object' ){
- window['animitter'] = exports;
-}
+exports.EventEmitter = EventEmitter;
View
4 tools/_pre.js
@@ -8,7 +8,7 @@
//**_Basic use:_**
//
-// animitter(function(){
+// loop = animitter(function(){
// //do this every time
// if(Math.random() > 0.9) this.complete();
-// });
+// }).start();
View
12 tools/concat.js
@@ -4,7 +4,7 @@ var fs = require('fs'),
var src = './lib/';
var output = String(fs.readFileSync(__dirname+'/_pre.js'));
-output += '\nvar animitter = (function(){';
+output += '\n(function(){';
[ 'utils',
'events',
@@ -21,9 +21,13 @@ output += '\nvar animitter = (function(){';
].join('\n');
});
output += [
- '\n\treturn animitter;',
- '}());',
- 'animitter.version = "'+version+'";'
+ '\n\tanimitter.version = "'+version+'";',
+ '\tif( typeof define === "function" && define["amd"]){',
+ '\t\tdefine(function(){ return animitter; });',
+ '\t} else if( typeof window === "object" ){',
+ '\t\twindow["animitter"] = animitter;',
+ '\t}',
+ '}());'
].join('\n');
fs.writeFileSync('./animitter.js', output );
Please sign in to comment.
Something went wrong with that request. Please try again.