shared-store
Advanced tools
Comparing version 2.1.1 to 2.1.2
@@ -0,1 +1,8 @@ | ||
### 2.1.2 | ||
* Safer interval handling - **[@jkrems](https://github.com/jkrems)** [#31](https://github.com/groupon/shared-store/pull/31) | ||
- [`bfb7276`](https://github.com/groupon/shared-store/commit/bfb72765ba460a2f1af73b93eb5715f222cdf0ba) **fix:** Safer interval handling | ||
- [`4bd2ffa`](https://github.com/groupon/shared-store/commit/4bd2ffaafa666916e7e6384ab41d7479affe46cd) **test:** Pass on node 6 | ||
### 2.1.1 | ||
@@ -2,0 +9,0 @@ |
@@ -43,3 +43,25 @@ | ||
} else { | ||
return load().concat(Observable.interval(interval).flatMap(load)); | ||
return Observable.create(function(observer) { | ||
var dispose, loadSubscription, prepareNext, runLoad, timeoutHandle; | ||
loadSubscription = timeoutHandle = null; | ||
dispose = function() { | ||
if (timeoutHandle) { | ||
clearTimeout(timeoutHandle); | ||
} | ||
if (loadSubscription) { | ||
loadSubscription.dispose(); | ||
} | ||
return loadSubscription = timeoutHandle = null; | ||
}; | ||
prepareNext = function() { | ||
dispose(); | ||
return timeoutHandle = setTimeout(runLoad, interval); | ||
}; | ||
runLoad = function() { | ||
dispose(); | ||
return loadSubscription = load().subscribe(observer.onNext.bind(observer), observer.onError.bind(observer), prepareNext); | ||
}; | ||
runLoad(); | ||
return dispose; | ||
}); | ||
} | ||
@@ -46,0 +68,0 @@ } else { |
{ | ||
"name": "shared-store", | ||
"version": "2.1.1", | ||
"version": "2.1.2", | ||
"description": "Keeping config data in sync", | ||
@@ -5,0 +5,0 @@ "license": "BSD-3-Clause", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
55253
1032