Index: lib/typoFixer.js |
=================================================================== |
--- a/lib/typoFixer.js |
+++ b/lib/typoFixer.js |
@@ -12,27 +12,43 @@ |
let appIntegration = require("typoAppIntegration"); |
let netError = require("typoNetError"); |
-// Attach our handlers to all browser windows |
-new WindowObserver( |
+ |
+let typoWindowObserver = null; |
+ |
+exports.attachWindowObserver = attachWindowObserver; |
+function attachWindowObserver() |
{ |
Wladimir Palant
2012/11/19 07:30:02
Please check whether the observer is already attac
|
- applyToWindow: function(window) |
+ // Attach our handlers to all browser windows |
+ typoWindowObserver = new WindowObserver( |
{ |
- if (!appIntegration.isKnownWindow(window)) |
- return; |
- |
- netError.applyToWindow(window); |
- appIntegration.applyToWindow(window, correctURL); |
- }, |
+ applyToWindow: function(window) |
+ { |
+ if (!appIntegration.isKnownWindow(window)) |
+ return; |
+ |
+ netError.applyToWindow(window); |
+ appIntegration.applyToWindow(window, correctURL); |
+ }, |
- removeFromWindow: function(window) |
- { |
- if (!appIntegration.isKnownWindow(window)) |
- return; |
- |
- netError.removeFromWindow(window); |
- appIntegration.removeFromWindow(window); |
- } |
-}); |
+ removeFromWindow: function(window) |
+ { |
+ if (!appIntegration.isKnownWindow(window)) |
+ return; |
+ |
+ netError.removeFromWindow(window); |
+ appIntegration.removeFromWindow(window); |
+ } |
+ }); |
+} |
+attachWindowObserver(); |
+ |
+exports.detachWindowObserver = detachWindowObserver; |
+function detachWindowObserver() |
+{ |
Wladimir Palant
2012/11/19 07:30:02
Please check whether the observer is already detac
|
+ // Detach our handlers from all browser windows |
+ typoWindowObserver.shutdown(); |
+ typoWindowObserver = null; |
+} |
function parseURL(url) |
{ |