custom module: receive() and send() now accept host and port to be provided as a single string argument joined by a colon
This commit is contained in:
parent
857e0408be
commit
bdd83657c8
3 changed files with 19 additions and 0 deletions
|
|
@ -22,6 +22,14 @@ class OscServer {
|
|||
sendOsc: this.sendOsc.bind(this),
|
||||
receiveOsc: this.receiveOsc.bind(this),
|
||||
send: (host, port, address, ...args)=>{
|
||||
if (host.indexOf(':') > -1) {
|
||||
args.unshift(address)
|
||||
address = port
|
||||
var split = host.split(':')
|
||||
host = split[0]
|
||||
port = parseInt(split[1])
|
||||
}
|
||||
|
||||
this.sendOsc({host, port, address, args:args.map(x=>this.parseArg(x))})
|
||||
},
|
||||
receive: (host, port, address, ...args)=>{
|
||||
|
|
@ -31,6 +39,12 @@ class OscServer {
|
|||
if (port !== undefined) args.unshift(port)
|
||||
address = host
|
||||
host = port = undefined
|
||||
} else if (host.indexOf(':') > -1) {
|
||||
args.unshift(address)
|
||||
address = port
|
||||
var split = host.split(':')
|
||||
host = split[0]
|
||||
port = parseInt(split[1])
|
||||
}
|
||||
var lastArg = args[args.length - 1],
|
||||
options = {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue