@webex/common-evented 3.0.0-beta.1 → 3.0.0-beta.2
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/dist/index.js +57 -0
- package/dist/index.js.map +1 -0
- package/package.json +4 -4
- package/CHANGELOG-v3.md +0 -12
package/dist/index.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
4
|
+
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
6
|
+
|
|
7
|
+
_Object$defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
exports.default = evented;
|
|
12
|
+
|
|
13
|
+
var _weakMap = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/weak-map"));
|
|
14
|
+
|
|
15
|
+
var _map = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/map"));
|
|
16
|
+
|
|
17
|
+
var _deleteProperty = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/reflect/delete-property"));
|
|
18
|
+
|
|
19
|
+
var _common = require("@webex/common");
|
|
20
|
+
|
|
21
|
+
var data = new ((0, _common.make)(_weakMap.default, _map.default))();
|
|
22
|
+
/**
|
|
23
|
+
* Given a class property, this decorator changes it into a setter/getter pair;
|
|
24
|
+
* the setter will trigger `change:${prop}` when invoked
|
|
25
|
+
* @param {Object} target
|
|
26
|
+
* @param {string} prop
|
|
27
|
+
* @param {Object} descriptor
|
|
28
|
+
* @returns {undefined}
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
function evented(target, prop, descriptor) {
|
|
32
|
+
var defaultValue = descriptor.initializer && descriptor.initializer();
|
|
33
|
+
(0, _deleteProperty.default)(descriptor, 'value');
|
|
34
|
+
(0, _deleteProperty.default)(descriptor, 'initializer');
|
|
35
|
+
(0, _deleteProperty.default)(descriptor, 'writable');
|
|
36
|
+
|
|
37
|
+
descriptor.get = function get() {
|
|
38
|
+
var value = data.get(this, prop);
|
|
39
|
+
|
|
40
|
+
if (typeof value !== 'undefined') {
|
|
41
|
+
return value;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return defaultValue;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
descriptor.set = function set(value) {
|
|
48
|
+
var previous = this[prop];
|
|
49
|
+
|
|
50
|
+
if (previous !== value) {
|
|
51
|
+
data.set(this, prop, value);
|
|
52
|
+
this.trigger("change:".concat(prop), value, previous);
|
|
53
|
+
this.trigger('change');
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["data","make","evented","target","prop","descriptor","defaultValue","initializer","get","value","set","previous","trigger"],"sources":["index.js"],"sourcesContent":["import {make} from '@webex/common';\n\nconst data = new (make(WeakMap, Map))();\n\n/**\n * Given a class property, this decorator changes it into a setter/getter pair;\n * the setter will trigger `change:${prop}` when invoked\n * @param {Object} target\n * @param {string} prop\n * @param {Object} descriptor\n * @returns {undefined}\n */\nexport default function evented(target, prop, descriptor) {\n const defaultValue = descriptor.initializer && descriptor.initializer();\n\n Reflect.deleteProperty(descriptor, 'value');\n Reflect.deleteProperty(descriptor, 'initializer');\n Reflect.deleteProperty(descriptor, 'writable');\n\n descriptor.get = function get() {\n const value = data.get(this, prop);\n\n if (typeof value !== 'undefined') {\n return value;\n }\n\n return defaultValue;\n };\n\n descriptor.set = function set(value) {\n const previous = this[prop];\n\n if (previous !== value) {\n data.set(this, prop, value);\n this.trigger(`change:${prop}`, value, previous);\n this.trigger('change');\n }\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;AAEA,IAAMA,IAAI,GAAG,KAAK,IAAAC,YAAA,iCAAL,GAAb;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACe,SAASC,OAAT,CAAiBC,MAAjB,EAAyBC,IAAzB,EAA+BC,UAA/B,EAA2C;EACxD,IAAMC,YAAY,GAAGD,UAAU,CAACE,WAAX,IAA0BF,UAAU,CAACE,WAAX,EAA/C;EAEA,6BAAuBF,UAAvB,EAAmC,OAAnC;EACA,6BAAuBA,UAAvB,EAAmC,aAAnC;EACA,6BAAuBA,UAAvB,EAAmC,UAAnC;;EAEAA,UAAU,CAACG,GAAX,GAAiB,SAASA,GAAT,GAAe;IAC9B,IAAMC,KAAK,GAAGT,IAAI,CAACQ,GAAL,CAAS,IAAT,EAAeJ,IAAf,CAAd;;IAEA,IAAI,OAAOK,KAAP,KAAiB,WAArB,EAAkC;MAChC,OAAOA,KAAP;IACD;;IAED,OAAOH,YAAP;EACD,CARD;;EAUAD,UAAU,CAACK,GAAX,GAAiB,SAASA,GAAT,CAAaD,KAAb,EAAoB;IACnC,IAAME,QAAQ,GAAG,KAAKP,IAAL,CAAjB;;IAEA,IAAIO,QAAQ,KAAKF,KAAjB,EAAwB;MACtBT,IAAI,CAACU,GAAL,CAAS,IAAT,EAAeN,IAAf,EAAqBK,KAArB;MACA,KAAKG,OAAL,kBAAuBR,IAAvB,GAA+BK,KAA/B,EAAsCE,QAAtC;MACA,KAAKC,OAAL,CAAa,QAAb;IACD;EACF,CARD;AASD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webex/common-evented",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.2",
|
|
4
4
|
"description": "Class property decorator the adds change events to properties",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
]
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@webex/common": "
|
|
23
|
+
"@webex/common": "3.0.0-beta.2"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@webex/common-evented": "
|
|
27
|
-
"@webex/test-helper-chai": "
|
|
26
|
+
"@webex/common-evented": "3.0.0-beta.2",
|
|
27
|
+
"@webex/test-helper-chai": "3.0.0-beta.2",
|
|
28
28
|
"ampersand-events": "^2.0.2",
|
|
29
29
|
"sinon": "^9.2.4"
|
|
30
30
|
}
|
package/CHANGELOG-v3.md
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# [3.0.0-beta.1](https://github.com/webex/webex-js-sdk/compare/v2.34.0...v3.0.0-beta.1) (2022-12-05)
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
### Features
|
|
5
|
-
|
|
6
|
-
* creating a beta release for v3 of SDK ([eee2433](https://github.com/webex/webex-js-sdk/commit/eee2433f33b7bf9a8ededfa5b838f0494a0ee49a))
|
|
7
|
-
* **plugin-meetings:** added connection type to "js_sdk_add_media_success" metric ([#2517](https://github.com/webex/webex-js-sdk/issues/2517)) ([bf685e4](https://github.com/webex/webex-js-sdk/commit/bf685e452f0efa03a62e1b552ad1bdeccd3efeb8))
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
### BREAKING CHANGES
|
|
11
|
-
|
|
12
|
-
* release breaking changes for multistream
|