From 2c4915f0b2e258dc406e5b13275e9c12a1da1f57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20F=2E=20Romaniello?= Date: Mon, 3 Sep 2012 09:57:26 -0300 Subject: [PATCH] check first for commonjs rather than AMD It will make a difference for me if this check first for common.js module system rather than AMD module system. This is exactly as you do in other projects like qwery, bean, reqwest and bonzo. Thanks, --- src/bowser.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/bowser.js b/src/bowser.js index 3b81fc5..ed596a2 100644 --- a/src/bowser.js +++ b/src/bowser.js @@ -1,7 +1,7 @@ -!function (name, definition) { - if (typeof define == 'function') define(definition) - else if (typeof module != 'undefined' && module.exports) module.exports['browser'] = definition() - else this[name] = definition() +!function (name, definition, context) { + if (typeof module != 'undefined' && module.exports) module.exports = definition() + else if (typeof context['define'] == 'function' && context['define']['amd']) define(name, definition) + else context[name] = definition() }('bowser', function () { /** * navigator.userAgent => @@ -113,4 +113,4 @@ } else bowser.x = t return bowser -}) +}, this)