当前位置: 首页 > 文档资料 > ThingJS 文档中心 >

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:
NameTypeDescription
flagsNumber

The flags what to check.

enableBoolean

Check whether it's enable or disable.

Returns:
Type
Boolean

clear(flags)

Clear flags.

Parameters:
NameTypeDescription
flagsNumber

The flags what to clear, if we do not provide it then indicates clear all flags.


combine(flags)

Combine flags.

Parameters:
NameTypeDescription
flagsNumber

The flags what to combine.


enable(flags, value) → {Boolean}

Enable/Disable flags.

Parameters:
NameTypeDescription
flagsNumber

The flags what to set or clear.

valueBoolean

True indicates enable it, otherwise disable it.

Returns:

True indicates flags has changed.

Type
Boolean

get(flags)

Get the enable state.

Parameters:
NameTypeDescription
flagsNumber

The flags what to check.


has(flags [, matchAll]) → {Boolean}

Check whether has flags.

Parameters:
NameTypeArgumentDefaultDescription
flagsNumber

The flags what to combine.

matchAllBoolean<optional>
false

True indicates try to match all flags, otherwise try to match any flags.

Returns:
Type
Boolean

set(flags)

Set flags.

Parameters:
NameTypeDescription
flagsNumber

The flags what to set.


watch(flag, callback)

Watch flag by name when changed.

Parameters:
NameTypeDescription
flagNumber

The flag what to watch.

callbackfunction

The callback function.