aboutsummaryrefslogtreecommitdiffstats
path: root/src/Browser.js
diff options
context:
space:
mode:
authorIgor Minar2010-09-25 15:29:48 -0700
committerIgor Minar2010-09-26 23:54:31 -0700
commit3eec8c1a517f8b93a5afd15b7f83b33c5df7e54b (patch)
tree9d9574d2245257456966bb0d15853f8f0d620958 /src/Browser.js
parent9171a2b2b50d0a8217c98e0017a7d2a0a1a37380 (diff)
downloadangular.js-3eec8c1a517f8b93a5afd15b7f83b33c5df7e54b.tar.bz2
Properly initialize cookie service in order to preserve existing cookies
- previously the poller initialized the cookie cache too late which was causing previously existing cookies to be deleted by cookie service - refactored the poller api so that the addPollFn returns the added fn - fixed older cookie service tests - removed "this.$onEval(PRIORITY_LAST, update);" because it is not needed
Diffstat (limited to 'src/Browser.js')
-rw-r--r--src/Browser.js17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/Browser.js b/src/Browser.js
index c7e61e97..e3c768ca 100644
--- a/src/Browser.js
+++ b/src/Browser.js
@@ -79,8 +79,21 @@ function Browser(location, document, head, XHR, $log) {
foreach(pollFns, function(pollFn){ pollFn(); });
}
self.poll = poll;
- self.addPollFn = bind(pollFns, push);
- self.startPoller = function(interval, setTimeout){
+
+ /**
+ * Adds a function to the list of functions that poller periodically executes
+ * @return {Function} the added function
+ */
+ self.addPollFn = function(/**Function*/fn){
+ pollFns.push(fn);
+ return fn;
+ };
+
+ /**
+ * Configures the poller to run in the specified intervals, using the specified setTimeout fn and
+ * kicks it off.
+ */
+ self.startPoller = function(/**number*/interval, /**Function*/setTimeout){
(function check(){
poll();
setTimeout(check, interval);