Merge pull request #13328 from calixteman/js_display1

JS - Add support for display property
This commit is contained in:
Brendan Dahl 2021-05-17 08:47:13 -07:00 committed by GitHub
commit 17e9cfcd2a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 197 additions and 141 deletions

View file

@ -14,6 +14,13 @@
*/
class ProxyHandler {
constructor() {
// Don't dispatch an event for those properties.
// - delay: allow to delay field redraw until delay is set to false.
// Likely it's useless to implement that stuff.
this.nosend = new Set(["delay"]);
}
get(obj, prop) {
// script may add some properties to the object
if (prop in obj._expandos) {
@ -49,7 +56,12 @@ class ProxyHandler {
if (typeof prop === "string" && !prop.startsWith("_") && prop in obj) {
const old = obj[prop];
obj[prop] = value;
if (obj._send && obj._id !== null && typeof old !== "function") {
if (
!this.nosend.has(prop) &&
obj._send &&
obj._id !== null &&
typeof old !== "function"
) {
const data = { id: obj._id };
data[prop] = obj[prop];