Class: Flags
优质
小牛编辑
123浏览
2023-12-01
THING~ Flags
Flags The flags.
new Flags()
constructor.
Members
onChange :function
Get/Set change callback function
Type:
- function
values :Number
Get the values.
Type:
- Number
Methods
check(flags, enable) → {Boolean}
Check flag.
Parameters:
Name Type Description flags
Number The flags what to check.
enable
Boolean Check whether it's enable or disable.
Returns:
- Type
- Boolean
clear(flags)
Clear flags.
Parameters:
Name Type Description flags
Number The flags what to clear, if we do not provide it then indicates clear all flags.
combine(flags)
Combine flags.
Parameters:
Name Type Description flags
Number The flags what to combine.
enable(flags, value) → {Boolean}
Enable/Disable flags.
Parameters:
Name Type Description flags
Number The flags what to set or clear.
value
Boolean True indicates enable it, otherwise disable it.
Returns:
True indicates flags has changed.
- Type
- Boolean
get(flags)
Get the enable state.
Parameters:
Name Type Description flags
Number The flags what to check.
has(flags [, matchAll]) → {Boolean}
Check whether has flags.
Parameters:
Name Type Argument Default Description flags
Number The flags what to combine.
matchAll
Boolean <optional> false True indicates try to match all flags, otherwise try to match any flags.
Returns:
- Type
- Boolean
set(flags)
Set flags.
Parameters:
Name Type Description flags
Number The flags what to set.
watch(flag, callback)
Watch flag by name when changed.
Parameters:
Name Type Description flag
Number The flag what to watch.
callback
function The callback function.