Closed soanaphikeste closed 9 years ago
This is by design. While not optimal, it's far more confusing for a function to suddenly change from returning a single value to returning an array based on server admin adding/renaming channels.
Added channelByPath()
to MumbleClient. You can use this with:
// Get the root channel
var root = client.channelByPath( '/' );
// Get the Root > Test2 > A channel
var test2a = client.channelByPath( '/Test2/A' );
If you need something else, you can always build your own lookup routines on top of the client.rootChannel and Channel.children collection.
Thank you :)
I don't know. I think it is a better idea to always return an array, if there is only one channel with the specified name, return an array with only one item. But returning only one channel when there are multiple channels without having defined behaviour which one will be returned sounds like bad design.
Yeah. I'm guessing the channelByPath
fixed this. If not, there's always the Channel.children
collection. Closing this.
When there are multiple channels with the same name,
channelByName
will only return one of them.For example this is a valid channel structure (at least the official client allows it to be created):
Then calling
myMumbleConnection.channelByName("A")
will return/Root/Test 1/A
, but not/Root/Test 2/A
.