Comparing version 1.4.1 to 1.4.2
@@ -0,0 +0,0 @@ const { |
@@ -0,0 +0,0 @@ function noop() {} |
'use strict'; | ||
require('core-js/modules/es.array.reduce.js'); | ||
require('core-js/modules/es.object.assign.js'); | ||
require('core-js/modules/es.object.set-prototype-of.js'); | ||
require('core-js/modules/es.object.to-string.js'); | ||
require('core-js/modules/es.promise.js'); | ||
require('core-js/modules/es.array.reduce'); | ||
require('core-js/modules/es.object.assign'); | ||
require('core-js/modules/es.object.set-prototype-of'); | ||
require('core-js/modules/es.object.to-string'); | ||
require('core-js/modules/es.promise'); | ||
@@ -9,0 +9,0 @@ function _classCallCheck(instance, Constructor) { |
'use strict'; | ||
require('core-js/modules/es.array.concat.js'); | ||
require('core-js/modules/es.array.every.js'); | ||
require('core-js/modules/es.array.for-each.js'); | ||
require('core-js/modules/es.array.iterator.js'); | ||
require('core-js/modules/es.array.map.js'); | ||
require('core-js/modules/es.object.to-string.js'); | ||
require('core-js/modules/es.set.js'); | ||
require('core-js/modules/es.string.iterator.js'); | ||
require('core-js/modules/web.dom-collections.for-each.js'); | ||
require('core-js/modules/web.dom-collections.iterator.js'); | ||
require('core-js/modules/es.array.concat'); | ||
require('core-js/modules/es.array.every'); | ||
require('core-js/modules/es.array.for-each'); | ||
require('core-js/modules/es.array.iterator'); | ||
require('core-js/modules/es.array.map'); | ||
require('core-js/modules/es.object.to-string'); | ||
require('core-js/modules/es.set'); | ||
require('core-js/modules/es.string.iterator'); | ||
require('core-js/modules/web.dom-collections.for-each'); | ||
require('core-js/modules/web.dom-collections.iterator'); | ||
@@ -14,0 +14,0 @@ function _classCallCheck(instance, Constructor) { |
'use strict'; | ||
require('core-js/modules/es.symbol.js'); | ||
require('core-js/modules/es.symbol.description.js'); | ||
require('core-js/modules/es.array.concat.js'); | ||
require('core-js/modules/es.array.for-each.js'); | ||
require('core-js/modules/es.array.iterator.js'); | ||
require('core-js/modules/es.array.slice.js'); | ||
require('core-js/modules/es.object.to-string.js'); | ||
require('core-js/modules/es.promise.js'); | ||
require('core-js/modules/es.set.js'); | ||
require('core-js/modules/es.string.iterator.js'); | ||
require('core-js/modules/web.dom-collections.for-each.js'); | ||
require('core-js/modules/web.dom-collections.iterator.js'); | ||
require('core-js/modules/es.symbol'); | ||
require('core-js/modules/es.symbol.description'); | ||
require('core-js/modules/es.array.concat'); | ||
require('core-js/modules/es.array.for-each'); | ||
require('core-js/modules/es.array.iterator'); | ||
require('core-js/modules/es.array.slice'); | ||
require('core-js/modules/es.object.to-string'); | ||
require('core-js/modules/es.promise'); | ||
require('core-js/modules/es.set'); | ||
require('core-js/modules/es.string.iterator'); | ||
require('core-js/modules/web.dom-collections.for-each'); | ||
require('core-js/modules/web.dom-collections.iterator'); | ||
@@ -16,0 +16,0 @@ function _classCallCheck(instance, Constructor) { |
'use strict'; | ||
require('core-js/modules/es.function.name.js'); | ||
require('regenerator-runtime/runtime.js'); | ||
require('core-js/modules/es.function.name'); | ||
require('regenerator-runtime/runtime'); | ||
@@ -6,0 +6,0 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { |
'use strict'; | ||
require('core-js/modules/es.array.filter.js'); | ||
require('core-js/modules/es.array.find.js'); | ||
require('core-js/modules/es.array.find-index.js'); | ||
require('core-js/modules/es.array.reduce.js'); | ||
require('core-js/modules/es.array.filter'); | ||
require('core-js/modules/es.array.find'); | ||
require('core-js/modules/es.array.find-index'); | ||
require('core-js/modules/es.array.reduce'); | ||
@@ -8,0 +8,0 @@ function _classCallCheck(instance, Constructor) { |
'use strict'; | ||
require('core-js/modules/es.array.concat.js'); | ||
require('core-js/modules/es.array.reduce.js'); | ||
require('core-js/modules/es.array.concat'); | ||
require('core-js/modules/es.array.reduce'); | ||
@@ -6,0 +6,0 @@ function _classCallCheck(instance, Constructor) { |
'use strict'; | ||
require('core-js/modules/es.symbol.js'); | ||
require('core-js/modules/es.symbol.description.js'); | ||
require('core-js/modules/es.symbol.iterator.js'); | ||
require('core-js/modules/es.array.concat.js'); | ||
require('core-js/modules/es.array.find.js'); | ||
require('core-js/modules/es.array.iterator.js'); | ||
require('core-js/modules/es.object.to-string.js'); | ||
require('core-js/modules/es.promise.js'); | ||
require('core-js/modules/es.string.iterator.js'); | ||
require('core-js/modules/web.dom-collections.iterator.js'); | ||
require('core-js/modules/es.symbol'); | ||
require('core-js/modules/es.symbol.description'); | ||
require('core-js/modules/es.symbol.iterator'); | ||
require('core-js/modules/es.array.concat'); | ||
require('core-js/modules/es.array.find'); | ||
require('core-js/modules/es.array.iterator'); | ||
require('core-js/modules/es.object.to-string'); | ||
require('core-js/modules/es.promise'); | ||
require('core-js/modules/es.string.iterator'); | ||
require('core-js/modules/web.dom-collections.iterator'); | ||
@@ -104,5 +104,5 @@ function _toConsumableArray(arr) { | ||
var _require = require('./common'); | ||
_require.Sink; | ||
var noop = _require.noop; | ||
var _require = require('./common'), | ||
Sink = _require.Sink, | ||
noop = _require.noop; | ||
@@ -109,0 +109,0 @@ var _require2 = require('./combination'), |
'use strict'; | ||
require('core-js/modules/es.array.concat.js'); | ||
require('core-js/modules/es.array.map.js'); | ||
require('core-js/modules/es.string.repeat.js'); | ||
require('core-js/modules/es.array.concat'); | ||
require('core-js/modules/es.array.map'); | ||
require('core-js/modules/es.string.repeat'); | ||
@@ -7,0 +7,0 @@ function _classCallCheck(instance, Constructor) { |
!function(t){"function"==typeof define&&define.amd?define(t):t()}(function(){"use strict";function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function n(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&c(t,e)}function u(t){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function c(t,e){return(c=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function f(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}function s(t,e,n){return(s=f()?Reflect.construct:function(t,e,n){var r=[null];r.push.apply(r,e);r=new(Function.bind.apply(t,r));return n&&c(r,n.prototype),r}).apply(null,arguments)}function a(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function p(n){var r=f();return function(){var t,e=u(n);return a(this,r?(t=u(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments))}}function l(t,e,n){return(l="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){t=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=u(t)););return t}(t,e);if(t){e=Object.getOwnPropertyDescriptor(t,e);return e.get?e.get.call(n):e.value}})(t,e,n||t)}var t=require("./common"),h=t.Sink,e=t.deliver,y=t.noop;exports.Sink=h,exports.pipe=function(t){for(var e=arguments.length,n=new Array(1<e?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return n.reduce(function(t,e){return e(t)},t)};var v=function(){function i(t){o(this,i),this.subscribe=t;for(var e=arguments.length,n=new Array(1<e?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];this.source=(t=exports).pipe.apply(t,n)}return n(i,[{key:"start",value:function(){this.subscriber=this.subscribe(this.source)}},{key:"stop",value:function(){this.subscriber&&this.subscriber.dispose()}}]),i}();exports.reusePipe=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return s(v,e)},exports.toPromise=function(t){return new Promise(function(e,n){var r=new h;r.next=function(t){return r.value=t},r.complete=function(t){return t?n(t):e(r.value)},t(r)})},exports.subscribe=function(n){var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:y,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:y;return function(t){var e=new h;return e.next=n,e.complete=function(t){return t?r(t):i()},t(e),e}};t=function(){i(e,h);var t=p(e);function e(){return o(this,e),t.apply(this,arguments)}return n(e,[{key:"init",value:function(t){this.f=t}},{key:"next",value:function(t){(0,this.f)(t),this.sink.next(t)}}]),e}();exports.tap=e(t);t=function(){i(e,h);var t=p(e);function e(){return o(this,e),t.apply(this,arguments)}return n(e,[{key:"init",value:function(t){this.delayTime=t,this.buffer=[],this.timeoutId=[clearTimeout,,],this.defer(this.timeoutId)}},{key:"delay",value:function(t){this.timeoutId[2]=setTimeout(this.pop,t,this)}},{key:"pop",value:function(t){var e=t.buffer.shift(),n=e.time,e=e.data;t.sink.next(e),t.buffer.length&&t.delay(t.buffer[0].time-n)}},{key:"next",value:function(t){this.buffer.length||this.delay(this.delayTime),this.buffer.push({time:new Date,data:t})}},{key:"complete",value:function(t){var e=this;t?this.sink.complete(t):this.timeoutId[2]=setTimeout(function(){return e.sink.complete()},this.delayTime)}}]),e}();exports.delay=e(t);var b,d,m,t=function(){i(e,h);var t=p(e);function e(){return o(this,e),t.apply(this,arguments)}return n(e,[{key:"init",value:function(t){this.selector=t}},{key:"complete",value:function(t){t?this.selector(t)(this.sink):l(u(e.prototype),"complete",this).call(this)}}]),e}();exports.catchError=e(t),Object.assign(exports,require("./combination"),require("./filtering"),require("./mathematical"),require("./producer"),require("./transformation"),require("./vue3")),"undefined"==typeof Proxy?(b={},((d=function(t){return Object.setPrototypeOf(t,b)}).set=function(n){for(var t in n)!function(t){var e=n[t];switch(t){case"Sink":case"pipe":case"reusePipe":break;case"subscribe":b[t]=function(){return e.apply(void 0,arguments)(this)};break;case"toPromise":b[t]=function(){return e(this)};break;default:b[t]=function(){return d(e.apply(void 0,arguments)(this))},d[t]=function(){return d(e.apply(void 0,arguments))}}}(t)})(exports),exports.rx=d):(m={get:function(e,n){return e[n]||function(){var t;return new Proxy((t=exports)[n].apply(t,arguments)(e),m)}}},exports.rx=new Proxy(function(t){return new Proxy(t,m)},{get:function(t,e){return function(){var t;return new Proxy((t=exports)[e].apply(t,arguments),m)}},set:function(t,e,n){return exports[e]=n}}))}); | ||
//# sourceMappingURL=umd.js.map |
'use strict'; | ||
require('core-js/modules/es.array.for-each.js'); | ||
require('core-js/modules/es.array.iterator.js'); | ||
require('core-js/modules/es.object.to-string.js'); | ||
require('core-js/modules/es.set.js'); | ||
require('core-js/modules/es.string.iterator.js'); | ||
require('core-js/modules/web.dom-collections.for-each.js'); | ||
require('core-js/modules/web.dom-collections.iterator.js'); | ||
require('core-js/modules/es.array.for-each'); | ||
require('core-js/modules/es.array.iterator'); | ||
require('core-js/modules/es.object.to-string'); | ||
require('core-js/modules/es.set'); | ||
require('core-js/modules/es.string.iterator'); | ||
require('core-js/modules/web.dom-collections.for-each'); | ||
require('core-js/modules/web.dom-collections.iterator'); | ||
@@ -11,0 +11,0 @@ exports.eventHandler = function () { |
@@ -0,0 +0,0 @@ const { Sink } = require('./common') |
@@ -0,0 +0,0 @@ const { |
@@ -0,0 +0,0 @@ const { |
@@ -0,0 +0,0 @@ declare namespace Rx { |
@@ -0,0 +0,0 @@ const { |
@@ -0,0 +0,0 @@ const { |
{ | ||
"name": "fastrx", | ||
"version": "1.4.1", | ||
"version": "1.4.2", | ||
"description": "fast rxjs implemention", | ||
@@ -5,0 +5,0 @@ "main": "dist/cjs.js", |
@@ -0,0 +0,0 @@ const { |
@@ -90,26 +90,41 @@ #rx4rx-fast | ||
import { rx } from "fastrx"; | ||
import { vueHookEvent } from "fastrx/extention"; | ||
Vue.use(vueHookEvent); | ||
import RxComputed from "fastrx/vue"; | ||
Vue.use(RxComputed); | ||
Vue.prototype.$rx = rx; | ||
//in vue | ||
this.$rx.interval(1000).takeUntil(this.$fromEvent("destroyed")).subscribe(()=>{}) | ||
``` | ||
```html | ||
<template> | ||
<div @click.native="handler"></div> | ||
<div @click="onClick1" :style="{top:x+'px',left:y+'px'}"> | ||
<span>{{test1}}</span> | ||
<span>{{test0}}</span> | ||
</div> | ||
</template> | ||
<script> | ||
import {rx} from 'fastrx' | ||
const ob = rx.eventHandler() | ||
export default { | ||
data(){ | ||
return {handler:ob.handler} | ||
}, | ||
mounted(){ | ||
ob.subscribe(()=>{ | ||
}) | ||
} | ||
rxComputed:{ | ||
test0:_this=>rx.interval(1000).take(10),//简单的订阅 | ||
test_watch:{//使用watch触发Observable发射数据 | ||
get:ob=>ob.switchMapTo(rx.interval(1000)).map(x=>10-x) | ||
watch:"test1" | ||
}, | ||
test1:{//使用设置方法的方式触发,可以提供给事件回调 | ||
get:ob=>ob.switchMap(rx.timer(1000)), | ||
handler:"onClick1" | ||
}, | ||
test2:{ | ||
call:true,//调用test2方法而不是设置属性 | ||
get:ob=>ob.switchMap(e=>rx.timer(1000).map(()=>e)), | ||
handler:"onClick1" | ||
}, | ||
"x,y":{//采用解构,将结果对象中的x,y属性分别写入vue实例中的x和y属性 | ||
get:ob=>ob.switchMap(e=>rx.timer(1000).map(()=>({x:e.screenX,y:e.screenY}))), | ||
handler:"onClick1" | ||
} | ||
}, | ||
methods:{ | ||
test2(e){ | ||
console.log(e) | ||
} | ||
} | ||
} | ||
@@ -122,3 +137,3 @@ </script> | ||
<template> | ||
<div @click.native="handler"></div> | ||
<div @click="handler"></div> | ||
</template> | ||
@@ -125,0 +140,0 @@ <script> |
@@ -0,0 +0,0 @@ import babel from 'rollup-plugin-babel'; |
@@ -0,0 +0,0 @@ const { rx } = require('../index') |
@@ -0,0 +0,0 @@ const { |
11
vue.js
@@ -35,10 +35,11 @@ const { rx } = require('./index') | ||
const item = rxComputed[key] | ||
const keys = key.split(',') | ||
const setFunc = keys.length > 1 ? data => keys.forEach(k => this[k] = data[k]) : data => this[key] = data | ||
if (typeof item == 'function') { | ||
const ob = item(this) | ||
this.$data._rxComputed.push(ob.subscribe(data => this[key] = data)) | ||
this.$data._rxComputed.push(ob.subscribe(setFunc)) | ||
} else { | ||
const subject = this.$data._rxSubjects[key] | ||
this.$data._rxComputed.push(item.get(subject).subscribe(data => this[key] = data)) | ||
this.$data._rxComputed.push(item.get(subject).subscribe(item.call ? data => this[key](data) : setFunc)) | ||
if ('watch' in item) { | ||
this.$data._rxComputed.push(item.get(subject).subscribe(data => this[key] = data)) | ||
if (typeof item.watch == 'object') { | ||
@@ -79,4 +80,4 @@ for (const name in item.watch) { | ||
if (typeof item == 'object') { | ||
data._rxSubjects[key] = rx.subject() | ||
if ('handler' in item) { | ||
if (!data._rxSubjects[key]) data._rxSubjects[key] = rx.subject() | ||
if ('handler' in item && !data[item.handler]) { | ||
data[item.handler] = function (e) { | ||
@@ -83,0 +84,0 @@ data._rxSubjects[key].next(e) |
@@ -0,0 +0,0 @@ exports.eventHandler = (once = true) => { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
4766
151
253399