Comparing version 2.1.3 to 2.2.0
{ | ||
"name": "vue-rx", | ||
"version": "2.1.3", | ||
"version": "2.2.0", | ||
"description": "RxJS bindings for Vue", | ||
@@ -5,0 +5,0 @@ "main": "vue-rx.js", |
@@ -30,3 +30,3 @@ # vue-rx | ||
import { Observable } from 'rxjs/Observable' | ||
import { Subscription } from 'rxjs/Subscription' | ||
import { Subscription } from 'rxjs/Subscription' // Disposable if using RxJS4 | ||
@@ -114,2 +114,16 @@ // tada! | ||
#### `$subscribeTo(observable, next, error, complete)` | ||
This is a prototype method added to instances. You can use it to subscribe to an observable, but let VueRx manage the dispose/unsubscribe. | ||
``` js | ||
var vm = new Vue({ | ||
mounted () { | ||
this.$subscribeTo(Rx.Observable.interval(1000), function (count) { | ||
console.log(count) | ||
}) | ||
} | ||
}) | ||
``` | ||
#### `$fromDOMEvent(selector, event)` | ||
@@ -116,0 +130,0 @@ |
@@ -108,3 +108,3 @@ (function () { | ||
if (typeof window === 'undefined') { | ||
return Rx.Observable.create(() => {}) | ||
return Rx.Observable.create(function () {}) | ||
} | ||
@@ -137,2 +137,8 @@ | ||
} | ||
Vue.prototype.$subscribeTo = function(observable, next, error, complete) { | ||
var obs$ = observable.subscribe(next, error, complete) | ||
;(this._obSubscriptions || (this._obSubscriptions = [])).push(obs$) | ||
return obs$ | ||
} | ||
} | ||
@@ -139,0 +145,0 @@ |
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
9762
142
154