You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
441 B
JavaScript
16 lines
441 B
JavaScript
const { POCSAGConnector } = require("./connectors")
|
|
|
|
class ConnectorRegistry {
|
|
constructor() {
|
|
this.Connectors = {}
|
|
}
|
|
register(connector) {
|
|
this.Connectors[ connector.name ] = connector
|
|
}
|
|
transmit(name, message) {
|
|
if (!this.Connectors[ name ]) throw "not registred"
|
|
this.Connectors[ name ].transmitMessage(message)
|
|
}
|
|
}
|
|
const registry = new ConnectorRegistry()
|
|
module.exports = registry |