@vueuse/rxjs
Advanced tools
Comparing version 8.3.1 to 8.4.0
@@ -9,8 +9,12 @@ import { ObservableInput, Observable, NextObserver, BehaviorSubject, Subject, Unsubscribable } from 'rxjs'; | ||
interface UseObservableOptions { | ||
interface UseObservableOptions<I> { | ||
onError?: (err: any) => void; | ||
/** | ||
* The value that should be set if the observable has not emitted. | ||
*/ | ||
initialValue?: I | undefined; | ||
} | ||
declare function useObservable<H>(observable: Observable<H>, options?: UseObservableOptions): Readonly<Ref<H>>; | ||
declare function useObservable<H, I = undefined>(observable: Observable<H>, options?: UseObservableOptions<I | undefined>): Readonly<Ref<H | I>>; | ||
interface UseSubjectOptions extends UseObservableOptions { | ||
interface UseSubjectOptions<I = undefined> extends Omit<UseObservableOptions<I>, 'initialValue'> { | ||
} | ||
@@ -17,0 +21,0 @@ declare function useSubject<H>(subject: BehaviorSubject<H>, options?: UseSubjectOptions): Ref<H>; |
@@ -91,3 +91,3 @@ ;var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) { | ||
function useObservable(observable, options) { | ||
const value = vueDemi.ref(); | ||
const value = vueDemi.ref(options == null ? void 0 : options.initialValue); | ||
const subscription = observable.subscribe({ | ||
@@ -94,0 +94,0 @@ next: (val) => value.value = val, |
@@ -1,1 +0,1 @@ | ||
var VueDemi=function(e,n,c){if(e.install)return e;if(n)if(n.version.slice(0,2)==="2.")if(c){for(var i in c)e[i]=c[i];e.isVue2=!0,e.isVue3=!1,e.install=function(){},e.Vue=n,e.Vue2=n,e.version=n.version}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(n.version.slice(0,2)==="3."){for(var i in n)e[i]=n[i];e.isVue2=!1,e.isVue3=!0,e.install=function(){},e.Vue=n,e.Vue2=void 0,e.version=n.version,e.set=function(o,u,l){return Array.isArray(o)?(o.length=Math.max(o.length,u),o.splice(u,1,l),l):(o[u]=l,l)},e.del=function(o,u){if(Array.isArray(o)){o.splice(u,1);return}delete o[u]}}else console.error("[vue-demi] Vue version "+n.version+" is unsupported.");else console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`.");return e}(this.VueDemi=this.VueDemi||(typeof VueDemi!="undefined"?VueDemi:{}),this.Vue||(typeof Vue!="undefined"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI!="undefined"?VueCompositionAPI:void 0));(function(e,n,c,i,o){"use strict";function u(r,t){return i.isRef(r)?new n.Observable(s=>{const v=i.watch(r,f=>s.next(f),t);return()=>{v()}}):n.from(r)}function l(r,t){return u(r,{immediate:!0}).pipe(c.filter(s=>s instanceof HTMLElement),c.mergeMap(s=>n.fromEvent(s,t)))}function b(r){return{next:t=>{r.value=t}}}function d(r,t){const s=i.ref(),v=r.subscribe({next:f=>s.value=f,error:t==null?void 0:t.onError});return o.tryOnScopeDispose(()=>{v.unsubscribe()}),s}function a(r,t){const s=i.ref(r instanceof n.BehaviorSubject?r.value:void 0),v=r.subscribe({next(f){s.value=f},error:t==null?void 0:t.onError});return i.watch(s,f=>{r.next(f)}),o.tryOnScopeDispose(()=>{v.unsubscribe()}),s}function p(r){o.tryOnScopeDispose(()=>{r.unsubscribe()})}e.from=u,e.fromEvent=l,e.toObserver=b,e.useObservable=d,e.useSubject=a,e.useSubscription=p,Object.defineProperty(e,"__esModule",{value:!0})})(this.VueUse=this.VueUse||{},rxjs,rxjs.operator,VueDemi,VueUse); | ||
var VueDemi=function(e,n,c){if(e.install)return e;if(n)if(n.version.slice(0,2)==="2.")if(c){for(var t in c)e[t]=c[t];e.isVue2=!0,e.isVue3=!1,e.install=function(){},e.Vue=n,e.Vue2=n,e.version=n.version}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(n.version.slice(0,2)==="3."){for(var t in n)e[t]=n[t];e.isVue2=!1,e.isVue3=!0,e.install=function(){},e.Vue=n,e.Vue2=void 0,e.version=n.version,e.set=function(i,u,l){return Array.isArray(i)?(i.length=Math.max(i.length,u),i.splice(u,1,l),l):(i[u]=l,l)},e.del=function(i,u){if(Array.isArray(i)){i.splice(u,1);return}delete i[u]}}else console.error("[vue-demi] Vue version "+n.version+" is unsupported.");else console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`.");return e}(this.VueDemi=this.VueDemi||(typeof VueDemi!="undefined"?VueDemi:{}),this.Vue||(typeof Vue!="undefined"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI!="undefined"?VueCompositionAPI:void 0));(function(e,n,c,t,i){"use strict";function u(r,o){return t.isRef(r)?new n.Observable(s=>{const v=t.watch(r,f=>s.next(f),o);return()=>{v()}}):n.from(r)}function l(r,o){return u(r,{immediate:!0}).pipe(c.filter(s=>s instanceof HTMLElement),c.mergeMap(s=>n.fromEvent(s,o)))}function d(r){return{next:o=>{r.value=o}}}function a(r,o){const s=t.ref(o==null?void 0:o.initialValue),v=r.subscribe({next:f=>s.value=f,error:o==null?void 0:o.onError});return i.tryOnScopeDispose(()=>{v.unsubscribe()}),s}function b(r,o){const s=t.ref(r instanceof n.BehaviorSubject?r.value:void 0),v=r.subscribe({next(f){s.value=f},error:o==null?void 0:o.onError});return t.watch(s,f=>{r.next(f)}),i.tryOnScopeDispose(()=>{v.unsubscribe()}),s}function p(r){i.tryOnScopeDispose(()=>{r.unsubscribe()})}e.from=u,e.fromEvent=l,e.toObserver=d,e.useObservable=a,e.useSubject=b,e.useSubscription=p,Object.defineProperty(e,"__esModule",{value:!0})})(this.VueUse=this.VueUse||{},rxjs,rxjs.operator,VueDemi,VueUse); |
{ | ||
"name": "@vueuse/rxjs", | ||
"version": "8.3.1", | ||
"version": "8.4.0", | ||
"description": "Enables RxJS reactive functions in Vue", | ||
@@ -42,3 +42,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@vueuse/shared": "8.3.1", | ||
"@vueuse/shared": "8.4.0", | ||
"vue-demi": "*" | ||
@@ -45,0 +45,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
15302
278
+ Added@vueuse/shared@8.4.0(transitive)
- Removed@vueuse/shared@8.3.1(transitive)
Updated@vueuse/shared@8.4.0