mirror of
https://github.com/umap-project/umap.git
synced 2025-05-06 06:21:49 +02:00
24 lines
662 B
JavaScript
24 lines
662 B
JavaScript
import { MapUpdater } from "../updaters/mapUpdater.js"
|
|
import { LayerGroupUpdater } from "../updaters/layerGroupUpdater.js"
|
|
|
|
|
|
// FIXME: Maybe name this MessagesDispatcher ?
|
|
export class MessagesReceiver {
|
|
|
|
constructor(map){
|
|
this.updaters = {
|
|
map: new MapUpdater(map),
|
|
layers: new LayerGroupUpdater(map)
|
|
}
|
|
}
|
|
|
|
dispatch(message){
|
|
// FIXME if message.subject not in this.updaters: throw
|
|
console.log("message", message)
|
|
const updater = this.updaters[message.subject]
|
|
switch(message.action){
|
|
case "set-data":
|
|
updater.setData(message)
|
|
}
|
|
}
|
|
}
|