@cloudcare/browser-core 3.1.22 → 3.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/helper/observable.js
CHANGED
|
@@ -14,7 +14,7 @@ var _Observable = function _Observable(onFirstSubscribe) {
|
|
|
14
14
|
_Observable.prototype = {
|
|
15
15
|
subscribe: function subscribe(f) {
|
|
16
16
|
this.observers.push(f);
|
|
17
|
-
if (
|
|
17
|
+
if (this.observers.length === 1 && this.onFirstSubscribe) {
|
|
18
18
|
this.onLastUnsubscribe = this.onFirstSubscribe(this) || undefined;
|
|
19
19
|
}
|
|
20
20
|
var _this = this;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observable.js","names":["_tools","require","_Observable","onFirstSubscribe","observers","onLastUnsubscribe","undefined","prototype","subscribe","f","push","length","_this","unsubscribe","filter","other","notify","data","each","observer","Observable","exports","mergeObservables","observables","slice","call","arguments","globalObservable","subscriptions","map","observable","subscription"],"sources":["../../src/helper/observable.js"],"sourcesContent":["import { each, filter, map } from './tools'\nvar _Observable = function (onFirstSubscribe) {\n this.observers = []\n this.onLastUnsubscribe = undefined\n this.onFirstSubscribe = onFirstSubscribe\n}\n_Observable.prototype = {\n subscribe: function (f) {\n this.observers.push(f)\n if (
|
|
1
|
+
{"version":3,"file":"observable.js","names":["_tools","require","_Observable","onFirstSubscribe","observers","onLastUnsubscribe","undefined","prototype","subscribe","f","push","length","_this","unsubscribe","filter","other","notify","data","each","observer","Observable","exports","mergeObservables","observables","slice","call","arguments","globalObservable","subscriptions","map","observable","subscription"],"sources":["../../src/helper/observable.js"],"sourcesContent":["import { each, filter, map } from './tools'\nvar _Observable = function (onFirstSubscribe) {\n this.observers = []\n this.onLastUnsubscribe = undefined\n this.onFirstSubscribe = onFirstSubscribe\n}\n_Observable.prototype = {\n subscribe: function (f) {\n this.observers.push(f)\n if (this.observers.length === 1 && this.onFirstSubscribe) {\n this.onLastUnsubscribe = this.onFirstSubscribe(this) || undefined\n }\n var _this = this\n return {\n unsubscribe: function () {\n _this.observers = filter(_this.observers, function (other) {\n return f !== other\n })\n if (!_this.observers.length && _this.onLastUnsubscribe) {\n _this.onLastUnsubscribe()\n }\n }\n }\n },\n notify: function (data) {\n each(this.observers, function (observer) {\n observer(data)\n })\n }\n}\nexport var Observable = _Observable\n\nexport function mergeObservables() {\n var observables = [].slice.call(arguments)\n return new Observable(function (globalObservable) {\n var subscriptions = map(observables, function (observable) {\n return observable.subscribe(function (data) {\n return globalObservable.notify(data)\n })\n })\n return function () {\n return each(subscriptions, function (subscription) {\n return subscription.unsubscribe()\n })\n }\n })\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAIC,WAAW,GAAG,SAAdA,WAAWA,CAAaC,gBAAgB,EAAE;EAC5C,IAAI,CAACC,SAAS,GAAG,EAAE;EACnB,IAAI,CAACC,iBAAiB,GAAGC,SAAS;EAClC,IAAI,CAACH,gBAAgB,GAAGA,gBAAgB;AAC1C,CAAC;AACDD,WAAW,CAACK,SAAS,GAAG;EACtBC,SAAS,EAAE,SAAAA,UAAUC,CAAC,EAAE;IACtB,IAAI,CAACL,SAAS,CAACM,IAAI,CAACD,CAAC,CAAC;IACtB,IAAI,IAAI,CAACL,SAAS,CAACO,MAAM,KAAK,CAAC,IAAI,IAAI,CAACR,gBAAgB,EAAE;MACxD,IAAI,CAACE,iBAAiB,GAAG,IAAI,CAACF,gBAAgB,CAAC,IAAI,CAAC,IAAIG,SAAS;IACnE;IACA,IAAIM,KAAK,GAAG,IAAI;IAChB,OAAO;MACLC,WAAW,EAAE,SAAAA,YAAA,EAAY;QACvBD,KAAK,CAACR,SAAS,GAAG,IAAAU,aAAM,EAACF,KAAK,CAACR,SAAS,EAAE,UAAUW,KAAK,EAAE;UACzD,OAAON,CAAC,KAAKM,KAAK;QACpB,CAAC,CAAC;QACF,IAAI,CAACH,KAAK,CAACR,SAAS,CAACO,MAAM,IAAIC,KAAK,CAACP,iBAAiB,EAAE;UACtDO,KAAK,CAACP,iBAAiB,CAAC,CAAC;QAC3B;MACF;IACF,CAAC;EACH,CAAC;EACDW,MAAM,EAAE,SAAAA,OAAUC,IAAI,EAAE;IACtB,IAAAC,WAAI,EAAC,IAAI,CAACd,SAAS,EAAE,UAAUe,QAAQ,EAAE;MACvCA,QAAQ,CAACF,IAAI,CAAC;IAChB,CAAC,CAAC;EACJ;AACF,CAAC;AACM,IAAIG,UAAU,GAAGlB,WAAW;AAAAmB,OAAA,CAAAD,UAAA,GAAAA,UAAA;AAE5B,SAASE,gBAAgBA,CAAA,EAAG;EACjC,IAAIC,WAAW,GAAG,EAAE,CAACC,KAAK,CAACC,IAAI,CAACC,SAAS,CAAC;EAC1C,OAAO,IAAIN,UAAU,CAAC,UAAUO,gBAAgB,EAAE;IAChD,IAAIC,aAAa,GAAG,IAAAC,UAAG,EAACN,WAAW,EAAE,UAAUO,UAAU,EAAE;MACzD,OAAOA,UAAU,CAACtB,SAAS,CAAC,UAAUS,IAAI,EAAE;QAC1C,OAAOU,gBAAgB,CAACX,MAAM,CAACC,IAAI,CAAC;MACtC,CAAC,CAAC;IACJ,CAAC,CAAC;IACF,OAAO,YAAY;MACjB,OAAO,IAAAC,WAAI,EAACU,aAAa,EAAE,UAAUG,YAAY,EAAE;QACjD,OAAOA,YAAY,CAAClB,WAAW,CAAC,CAAC;MACnC,CAAC,CAAC;IACJ,CAAC;EACH,CAAC,CAAC;AACJ","ignoreList":[]}
|
package/esm/helper/observable.js
CHANGED
|
@@ -7,7 +7,7 @@ var _Observable = function _Observable(onFirstSubscribe) {
|
|
|
7
7
|
_Observable.prototype = {
|
|
8
8
|
subscribe: function subscribe(f) {
|
|
9
9
|
this.observers.push(f);
|
|
10
|
-
if (
|
|
10
|
+
if (this.observers.length === 1 && this.onFirstSubscribe) {
|
|
11
11
|
this.onLastUnsubscribe = this.onFirstSubscribe(this) || undefined;
|
|
12
12
|
}
|
|
13
13
|
var _this = this;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observable.js","names":["each","filter","map","_Observable","onFirstSubscribe","observers","onLastUnsubscribe","undefined","prototype","subscribe","f","push","length","_this","unsubscribe","other","notify","data","observer","Observable","mergeObservables","observables","slice","call","arguments","globalObservable","subscriptions","observable","subscription"],"sources":["../../src/helper/observable.js"],"sourcesContent":["import { each, filter, map } from './tools'\nvar _Observable = function (onFirstSubscribe) {\n this.observers = []\n this.onLastUnsubscribe = undefined\n this.onFirstSubscribe = onFirstSubscribe\n}\n_Observable.prototype = {\n subscribe: function (f) {\n this.observers.push(f)\n if (
|
|
1
|
+
{"version":3,"file":"observable.js","names":["each","filter","map","_Observable","onFirstSubscribe","observers","onLastUnsubscribe","undefined","prototype","subscribe","f","push","length","_this","unsubscribe","other","notify","data","observer","Observable","mergeObservables","observables","slice","call","arguments","globalObservable","subscriptions","observable","subscription"],"sources":["../../src/helper/observable.js"],"sourcesContent":["import { each, filter, map } from './tools'\nvar _Observable = function (onFirstSubscribe) {\n this.observers = []\n this.onLastUnsubscribe = undefined\n this.onFirstSubscribe = onFirstSubscribe\n}\n_Observable.prototype = {\n subscribe: function (f) {\n this.observers.push(f)\n if (this.observers.length === 1 && this.onFirstSubscribe) {\n this.onLastUnsubscribe = this.onFirstSubscribe(this) || undefined\n }\n var _this = this\n return {\n unsubscribe: function () {\n _this.observers = filter(_this.observers, function (other) {\n return f !== other\n })\n if (!_this.observers.length && _this.onLastUnsubscribe) {\n _this.onLastUnsubscribe()\n }\n }\n }\n },\n notify: function (data) {\n each(this.observers, function (observer) {\n observer(data)\n })\n }\n}\nexport var Observable = _Observable\n\nexport function mergeObservables() {\n var observables = [].slice.call(arguments)\n return new Observable(function (globalObservable) {\n var subscriptions = map(observables, function (observable) {\n return observable.subscribe(function (data) {\n return globalObservable.notify(data)\n })\n })\n return function () {\n return each(subscriptions, function (subscription) {\n return subscription.unsubscribe()\n })\n }\n })\n}\n"],"mappings":"AAAA,SAASA,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,CAACC,SAAS,CAAC;EAC1C,OAAO,IAAIL,UAAU,CAAC,UAAUM,gBAAgB,EAAE;IAChD,IAAIC,aAAa,GAAGxB,GAAG,CAACmB,WAAW,EAAE,UAAUM,UAAU,EAAE;MACzD,OAAOA,UAAU,CAAClB,SAAS,CAAC,UAAUQ,IAAI,EAAE;QAC1C,OAAOQ,gBAAgB,CAACT,MAAM,CAACC,IAAI,CAAC;MACtC,CAAC,CAAC;IACJ,CAAC,CAAC;IACF,OAAO,YAAY;MACjB,OAAOjB,IAAI,CAAC0B,aAAa,EAAE,UAAUE,YAAY,EAAE;QACjD,OAAOA,YAAY,CAACd,WAAW,CAAC,CAAC;MACnC,CAAC,CAAC;IACJ,CAAC;EACH,CAAC,CAAC;AACJ","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcare/browser-core",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.23",
|
|
4
4
|
"main": "cjs/index.js",
|
|
5
5
|
"module": "esm/index.js",
|
|
6
6
|
"types": "types/index.d.ts",
|
|
@@ -22,5 +22,5 @@
|
|
|
22
22
|
"author": "dataflux",
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"description": "DataFlux RUM Web 端数据指标监控",
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "a69b3c11e9f5754160747bb80bafe857c0d095ca"
|
|
26
26
|
}
|
package/src/helper/observable.js
CHANGED
|
@@ -7,7 +7,7 @@ var _Observable = function (onFirstSubscribe) {
|
|
|
7
7
|
_Observable.prototype = {
|
|
8
8
|
subscribe: function (f) {
|
|
9
9
|
this.observers.push(f)
|
|
10
|
-
if (
|
|
10
|
+
if (this.observers.length === 1 && this.onFirstSubscribe) {
|
|
11
11
|
this.onLastUnsubscribe = this.onFirstSubscribe(this) || undefined
|
|
12
12
|
}
|
|
13
13
|
var _this = this
|