length
This commit is contained in:
10
input.cm
10
input.cm
@@ -100,7 +100,7 @@ function create_user(index, config) {
|
||||
|
||||
// Pop from control stack
|
||||
pop: function() {
|
||||
if (this.control_stack.length > 1) {
|
||||
if (length(this.control_stack) > 1) {
|
||||
return this.control_stack.pop()
|
||||
}
|
||||
return null
|
||||
@@ -108,8 +108,8 @@ function create_user(index, config) {
|
||||
|
||||
// Get current control target
|
||||
get target() {
|
||||
return this.control_stack.length > 0
|
||||
? this.control_stack[this.control_stack.length - 1]
|
||||
return length(this.control_stack) > 0
|
||||
? this.control_stack[length(this.control_stack) - 1]
|
||||
: null
|
||||
},
|
||||
|
||||
@@ -149,7 +149,7 @@ function create_user(index, config) {
|
||||
|
||||
// Pick user based on pairing policy
|
||||
function pick_user(canon) {
|
||||
if (_users.length == 0) return null
|
||||
if (length(_users) == 0) return null
|
||||
|
||||
// For last_used: always user 0, just update active device
|
||||
if (_config.pairing == 'last_used') {
|
||||
@@ -177,7 +177,7 @@ function pick_user(canon) {
|
||||
}
|
||||
|
||||
// For explicit pairing: find user paired to this device
|
||||
for (var i = 0; i < _users.length; i++) {
|
||||
for (var i = 0; i < length(_users); i++) {
|
||||
if (find(_users[i].paired_devices, canon.device_id) != null) {
|
||||
_users[i].active_device = canon.device_id
|
||||
return _users[i]
|
||||
|
||||
Reference in New Issue
Block a user