Skip to content
Browse files

Merge pull request #6 from e2daipi/master

optimisation of ua method
  • Loading branch information...
2 parents ef308a3 + 6258c8e commit 7ccabd129b6c08cffda1b03ac1556dbc9e174535 Tom Moor committed Feb 7, 2012
Showing with 7 additions and 4 deletions.
  1. +7 −4 tinycon.js
View
11 tinycon.js
@@ -24,11 +24,14 @@
fallback: true
};
- var ua = function(browser){
+ var ua = (function (browser) {
var agent = navigator.userAgent.toLowerCase();
- return agent.indexOf(browser) !== -1;
- };
-
+ // New function has access to 'agent' via closure
+ return function (browser) {
+ return agent.indexOf(browser) !== -1;
+ };
+ }());
+
var browser = {
chrome: ua('chrome'),
webkit: ua('chrome') || ua('safari'),

0 comments on commit 7ccabd1

Please sign in to comment.
Something went wrong with that request. Please try again.