Improved scatter closing. Added module to eslint.
This commit is contained in:
parent
0bcf931465
commit
ca2ce289aa
@ -3,7 +3,8 @@
|
|||||||
"ecmaVersion": 10,
|
"ecmaVersion": 10,
|
||||||
"sourceType": "module",
|
"sourceType": "module",
|
||||||
"ecmaFeatures": {
|
"ecmaFeatures": {
|
||||||
"impliedStrict": true
|
"impliedStrict": true,
|
||||||
|
"modules": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"env": {
|
"env": {
|
||||||
|
@ -370,15 +370,22 @@ export class AbstractScatter extends Throwable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
close() {
|
close() {
|
||||||
|
this._callCloseCallbacks()
|
||||||
|
this._removeSelfFromScatterContainer()
|
||||||
|
}
|
||||||
|
|
||||||
|
_callCloseCallbacks() {
|
||||||
if (this.onClose) {
|
if (this.onClose) {
|
||||||
this.onClose.forEach(callback => callback(this))
|
this.onClose.forEach(callback => callback(this))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
_removeSelfFromScatterContainer() {
|
||||||
|
/**
|
||||||
Removes self from container when it's closed.
|
Removes self from container when it's closed.
|
||||||
*/
|
*/
|
||||||
if(this.container){
|
if (this.container) {
|
||||||
this.container.remove(this)
|
this.container.remove(this)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1007,17 +1014,22 @@ export class DOMScatterContainer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes an element from the scatter.
|
* Removes an element from the scatter.
|
||||||
*
|
*
|
||||||
* @param {Scatter} scatter - Element to remove.
|
* @param {Scatter} scatter - Element to remove.
|
||||||
* @memberof DOMScatterContainer
|
* @memberof DOMScatterContainer
|
||||||
*/
|
*/
|
||||||
remove(scatter){
|
remove(scatter) {
|
||||||
this.scatter.delete(scatter.element)
|
const element = scatter.element
|
||||||
}
|
if (!this.scatter.has(element))
|
||||||
|
console.warn(
|
||||||
|
`Try removing element that is not in the scatter.`,
|
||||||
|
element
|
||||||
|
)
|
||||||
|
|
||||||
|
this.scatter.delete(element)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds an element to the ScatterContainer.
|
* Adds an element to the ScatterContainer.
|
||||||
|
Loading…
Reference in New Issue
Block a user