Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue-rx

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-rx - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

LICENSE

2

package.json
{
"name": "vue-rx",
"version": "1.0.1",
"version": "1.1.0",
"description": "RxJS bindings for Vue",

@@ -5,0 +5,0 @@ "main": "vue-rx.js",

# vue-rx
Simple [RxJS](https://github.com/Reactive-Extensions/RxJS) binding for Vue.js (1.0.0+).
Simple [RxJS](https://github.com/Reactive-Extensions/RxJS) binding for Vue.js.

@@ -29,1 +29,5 @@ ### Usage

See `/example` for a simple example.
### License
[MIT](http://opensource.org/licenses/MIT)
(function () {
function VueRx (Vue) {
var VueVersion = Number(Vue.version && Vue.version.split('.')[0])
var initHook = VueVersion && VueVersion > 1 ? 'beforeCreate' : 'init'
var installed = false
function VueRx (Vue, Rx) {
if (installed) {
return
}
if (!Rx) {
if (typeof window !== 'undefined' && window.Rx) {
Rx = window.Rx
} else {
throw new Error(
'Make sure to pass in Rx if it is not available globally: Vue.use(VueRx, Rx)'
)
}
}
installed = true
Vue.mixin({
init: function () {
var self = this
var dataFn = this.$options.data
if (dataFn) {
this.$options.data = function () {
var raw = dataFn()
Object.keys(raw).forEach(function (key) {
var val = raw[key]
if (val instanceof Rx.Observable) {
raw[key] = null
;(self._rxHandles || (self._rxHandles = []))
.push(val.subscribe(function (value) {
self[key] = raw[key] = value
}))
}
})
return raw
}
}
},
var mixin = {
beforeDestroy: function () {

@@ -50,3 +14,26 @@ if (this._rxHandles) {

}
})
}
mixin[initHook] = function init () {
var self = this
var dataFn = this.$options.data
if (dataFn) {
this.$options.data = function () {
var raw = dataFn()
Object.keys(raw).forEach(function (key) {
var val = raw[key]
if (val.subscribe instanceof Function) {
raw[key] = null
;(self._rxHandles || (self._rxHandles = []))
.push(val.subscribe(function (value) {
self[key] = raw[key] = value
}))
}
})
return raw
}
}
}
Vue.mixin(mixin)
}

@@ -53,0 +40,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc