diff options
| author | Misko Hevery | 2010-04-05 11:46:53 -0700 |
|---|---|---|
| committer | Misko Hevery | 2010-04-05 11:46:53 -0700 |
| commit | 7a4b48020688060debe9cb0f9c17615d7585cbe7 (patch) | |
| tree | 48a5b1d8cf92bb272028a106ab9ea3ec16f477a2 /src/UrlWatcher.js | |
| parent | 4bfa4e230d5ebdd582068effe7f4f1b60c43093a (diff) | |
| download | angular.js-7a4b48020688060debe9cb0f9c17615d7585cbe7.tar.bz2 | |
added ng:switch widget
Diffstat (limited to 'src/UrlWatcher.js')
| -rw-r--r-- | src/UrlWatcher.js | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/src/UrlWatcher.js b/src/UrlWatcher.js deleted file mode 100644 index 1b2a9cf0..00000000 --- a/src/UrlWatcher.js +++ /dev/null @@ -1,46 +0,0 @@ - -// //////////////////////////// -// UrlWatcher -// //////////////////////////// - -function UrlWatcher(location) { - this.location = location; - this.delay = 25; - this.setTimeout = function(fn, delay) { - window.setTimeout(fn, delay); - }; - this.expectedUrl = location.href; - this.listeners = []; -} - -UrlWatcher.prototype = { - watch: function(fn){ - this.listeners.push(fn); - }, - - start: function() { - var self = this; - (function pull () { - if (self.expectedUrl !== self.location.href) { - foreach(self.listeners, function(listener){ - listener(self.location.href); - }); - self.expectedUrl = self.location.href; - } - self.setTimeout(pull, self.delay); - })(); - }, - - set: function(url) { - var existingURL = this.location.href; - if (!existingURL.match(/#/)) - existingURL += '#'; - if (existingURL != url) - this.location.href = url; - this.existingURL = url; - }, - - get: function() { - return this.location.href; - } -}; |
