智能照明系统APP-本地串口
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
LightingSystemApp-serial/.svn/pristine/e3/e3d2d8e20b4c644758326e6e35e...

36 lines
895 B

3 years ago
"use strict";
const { fireAnEvent } = require("../helpers/events");
const HTMLElementImpl = require("./HTMLElement-impl").implementation;
class HTMLDetailsElementImpl extends HTMLElementImpl {
constructor(args, privateData) {
super(args, privateData);
this._taskQueue = null;
}
_dispatchToggleEvent() {
this._taskQueue = null;
fireAnEvent("toggle", this);
}
_attrModified(name, value, oldValue) {
super._attrModified(name, value, oldValue);
if (name === "open" && this._taskQueue === null) {
// Check that the attribute is added or removed, not merely changed
if ((value !== oldValue && value !== null && oldValue === null) ||
(value === null && oldValue !== null)) {
this._taskQueue = setTimeout(this._dispatchToggleEvent.bind(this), 0);
}
}
}
}
module.exports = {
implementation: HTMLDetailsElementImpl
};