1 define("dojo/gears", ["./_base/lang", "./sniff"], function(lang, has){
10 lang.setObject("dojo.gears", gears);
12 gears._gearsObject = function(){
14 // factory method to get a Google Gears plugin instance to
15 // expose in the browser runtime environment, if present
18 var gearsObj = lang.getObject("google.gears");
19 if(gearsObj){ return gearsObj; } // already defined elsewhere
21 if(typeof GearsFactory != "undefined"){ // Firefox
22 factory = new GearsFactory();
27 factory = new ActiveXObject("Gears.Factory");
29 // ok to squelch; there's no gears factory. move on.
31 }else if(navigator.mimeTypes["application/x-googlegears"]){
33 factory = document.createElement("object");
34 factory.setAttribute("type", "application/x-googlegears");
35 factory.setAttribute("width", 0);
36 factory.setAttribute("height", 0);
37 factory.style.display = "none";
38 document.documentElement.appendChild(factory);
43 if(!factory){ return null; }
45 // define the global objects now; don't overwrite them though if they
46 // were somehow set internally by the Gears plugin, which is on their
47 // dev roadmap for the future
48 lang.setObject("google.gears.factory", factory);
49 return lang.getObject("google.gears");
53 // see if we have Google Gears installed, and if
54 // so, make it available in the runtime environment
55 // and in the Google standard 'google.gears' global object
56 gears.available = (!!gears._gearsObject())||0;
60 // True if client is using Google Gears