Browse files

update to support requirejs

  • Loading branch information...
1 parent b9ef983 commit 4669e5c6a9dcb76bd94cc8d522739a08c66a36bd @haggen committed Sep 5, 2012
Showing with 8 additions and 4 deletions.
  1. +6 −2 way.js
  2. +2 −2 way.min.js
View
8 way.js
@@ -1,5 +1,5 @@
/*
- * WayJS v0.3.2 2012-09-05 19:35:01 -0300
+ * WayJS v0.3.3 2012-09-05 23:14:53 -0300
* by Arthur Corenzan <arthur@corenzan.com>
* licensed under http://creativecommons.org/licenses/by/3.0
* more on http://haggen.github.com/wayjs
@@ -82,7 +82,11 @@
};
if(typeof window === 'object') {
- window.way = new Way();
+ if(typeof window.define === 'function' && 'amd' in window.define) {
+ window.define('way', function() { return new Way(); });
+ } else {
+ window.way = new Way();
+ }
} else if(typeof module === 'object' && 'exports' in module) {
module.exports = new Way();
}
View
4 way.min.js
@@ -1,7 +1,7 @@
/*
- * WayJS v0.3.2 2012-09-05 19:35:01 -0300
+ * WayJS v0.3.3 2012-09-05 23:14:53 -0300
* by Arthur Corenzan <arthur@corenzan.com>
* licensed under http://creativecommons.org/licenses/by/3.0
* more on http://haggen.github.com/wayjs
*/
-(function(e){"use strict";var t;t=function(){this.routes=[]},t.prototype={map:function(){var e={};e.params=[],e.pattern=this.translate([].shift.apply(arguments),e),e.actions=[].slice.apply(arguments),this.routes.push(e)},translate:function(e,t){var n;return n=e.replace(/\//g,"\\/"),n=n.replace(/\)/g,function(){return")?"}),n=n.replace(/:(\w[\w\d]*)|\(/g,function(e,n){return t.params.push(e==="("?"_":n),e==="("?"(":"([^\\/]+?)"}),n=n.replace(/\*/g,function(){return t.params.push("splat"),"(.+?)"}),new RegExp("^"+n+"$")},match:function(e){var t,n,r,i,s,o;for(s=0;s<this.routes.length;s++){t=this.routes[s],n={actions:t.actions,params:{}},i=e.match(t.pattern);if(i){for(o=1;o<i.length;o++)r=t.params[o-1],r==="splat"?"splat"in n.params?n.params.splat.push(i[o]):n.params.splat=[i[o]]:n.params[r]=i[o];return n}}}},typeof window=="object"?window.way=new t:typeof module=="object"&&"exports"in module&&(module.exports=new t)})();
+(function(e){"use strict";var t;t=function(){this.routes=[]},t.prototype={map:function(){var e={};e.params=[],e.pattern=this.translate([].shift.apply(arguments),e),e.actions=[].slice.apply(arguments),this.routes.push(e)},translate:function(e,t){var n;return n=e.replace(/\//g,"\\/"),n=n.replace(/\)/g,function(){return")?"}),n=n.replace(/:(\w[\w\d]*)|\(/g,function(e,n){return t.params.push(e==="("?"_":n),e==="("?"(":"([^\\/]+?)"}),n=n.replace(/\*/g,function(){return t.params.push("splat"),"(.+?)"}),new RegExp("^"+n+"$")},match:function(e){var t,n,r,i,s,o;for(s=0;s<this.routes.length;s++){t=this.routes[s],n={actions:t.actions,params:{}},i=e.match(t.pattern);if(i){for(o=1;o<i.length;o++)r=t.params[o-1],r==="splat"?"splat"in n.params?n.params.splat.push(i[o]):n.params.splat=[i[o]]:n.params[r]=i[o];return n}}}},typeof window=="object"?typeof window.define=="function"&&"amd"in window.define?window.define("way",function(){return new t}):window.way=new t:typeof module=="object"&&"exports"in module&&(module.exports=new t)})();

0 comments on commit 4669e5c

Please sign in to comment.