Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

optimisation #6

Merged
merged 1 commit into from

2 participants

@darrhiggs

No description provided.

@tommoor tommoor merged commit 7ccabd1 into tommoor:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 8, 2012
This page is out of date. Refresh to see the latest.
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'),
Something went wrong with that request. Please try again.