| 1 |
define(["dojo/_base/lang","../_base", "dojo/ready", "dojo/_base/config", "dojo/aspect" |
| 2 |
], function(lang, dxa, ready, config, aspect){ |
| 3 |
|
| 4 |
|
| 5 |
return (dxa.plugins.window = new (function(){ |
| 6 |
this.addData = lang.hitch(dxa, "addData", "window"); |
| 7 |
this.windowConnects = config["windowConnects"] || ["open", "onerror"]; |
| 8 |
|
| 9 |
for(var i = 0; i < this.windowConnects.length;i++){ |
| 10 |
aspect.after(window, this.windowConnects[i], lang.hitch(this, "addData", this.windowConnects[i]),true); |
| 11 |
} |
| 12 |
|
| 13 |
ready(lang.hitch(this, function(){ |
| 14 |
var data = {}; |
| 15 |
for(var i in window){ |
| 16 |
if(typeof window[i] == "object" || typeof window[i] == "function"){ |
| 17 |
switch(i){ |
| 18 |
case "location": |
| 19 |
case "console": |
| 20 |
data[i] = window[i]; |
| 21 |
break; |
| 22 |
default: |
| 23 |
break; |
| 24 |
} |
| 25 |
}else{ |
| 26 |
data[i] = window[i]; |
| 27 |
} |
| 28 |
} |
| 29 |
this.addData(data); |
| 30 |
})); |
| 31 |
})()); |
| 32 |
}); |