Browse Source

Added remove capability to scatter.(Merged local branch 'scatter')

obersalzberg
Severin Opel 1 year ago
parent
commit
0bcf931465
1 changed files with 25 additions and 0 deletions
  1. +25
    -0
      lib/scatter.js

+ 25
- 0
lib/scatter.js View File

@ -372,6 +372,13 @@ export class AbstractScatter extends Throwable {
close() {
if (this.onClose) {
this.onClose.forEach(callback => callback(this))
/**
Removes self from container when it's closed.
*/
if(this.container){
this.container.remove(this)
}
}
}
@ -1000,6 +1007,24 @@ export class DOMScatterContainer {
}
}
/**
* Removes an element from the scatter.
*
* @param {Scatter} scatter - Element to remove.
* @memberof DOMScatterContainer
*/
remove(scatter){
this.scatter.delete(scatter.element)
}
/**
* Adds an element to the ScatterContainer.
*
* @param {Scatter} scatter - Element to add to the ScatterContainer.
* @memberof DOMScatterContainer
*/
add(scatter) {
this.scatter.set(scatter.element, scatter)
}

Loading…
Cancel
Save