Preparing search index...
The search index is not available
micro:bit Web Bluetooth API Documentation
micro:bit Web Bluetooth API Documentation
services/button
ButtonService
Class ButtonService
Button Service
Hierarchy
TypedDispatcher
<
ButtonEvents
,
this
>
ButtonService
Index
Methods
add
Event
Listener
add
Listener
dispatch
Event
emit
event
Names
get
Max
Listeners
listener
Count
listeners
off
on
once
prepend
Listener
prepend
Once
Listener
raw
Listeners
read
ButtonAState
read
ButtonBState
remove
All
Listeners
remove
Event
Listener
remove
Listener
set
Max
Listeners
Methods
add
Event
Listener
add
Event
Listener
<
K
>
(
type
,
listener
)
:
void
Type Parameters
K
extends
keyof
ButtonEvents
Parameters
type
:
K
listener
:
(
(
event
:
CustomEvent
<
ButtonEvents
[
K
]
>
)
=>
void
)
(
event
)
:
void
Parameters
event
:
CustomEvent
<
ButtonEvents
[
K
]
>
Returns
void
Returns
void
add
Listener
add
Listener
<
K
>
(
event
,
listener
)
:
this
Type Parameters
K
extends
keyof
ButtonEvents
Parameters
event
:
K
listener
:
(
(
data
:
ButtonEvents
[
K
]
)
=>
void
)
(
data
)
:
void
Parameters
data
:
ButtonEvents
[
K
]
Returns
void
Returns
this
dispatch
Event
dispatch
Event
(
event
)
:
boolean
Parameters
event
:
CustomEvent
<
ButtonEvents
>
Returns
boolean
dispatch
Event
<
K
>
(
type
,
detail
)
:
boolean
Type Parameters
K
extends
keyof
ButtonEvents
Parameters
type
:
K
detail
:
ButtonEvents
[
K
]
Returns
boolean
emit
emit
<
K
>
(
event
,
data
)
:
boolean
Type Parameters
K
extends
keyof
ButtonEvents
Parameters
event
:
K
data
:
ButtonEvents
[
K
]
Returns
boolean
event
Names
event
Names
<
K
>
(
)
:
K
[]
Type Parameters
K
extends
keyof
ButtonEvents
Returns
K
[]
get
Max
Listeners
get
Max
Listeners
(
)
:
number
Returns
number
listener
Count
listener
Count
<
K
>
(
type
)
:
number
Type Parameters
K
extends
keyof
ButtonEvents
Parameters
type
:
K
Returns
number
listeners
listeners
<
K
>
(
event
)
:
Function
[]
Type Parameters
K
extends
keyof
ButtonEvents
Parameters
event
:
K
Returns
Function
[]
off
off
<
K
>
(
event
,
listener
)
:
this
Type Parameters
K
extends
keyof
ButtonEvents
Parameters
event
:
K
listener
:
(
(
data
:
ButtonEvents
[
K
]
)
=>
void
)
(
data
)
:
void
Parameters
data
:
ButtonEvents
[
K
]
Returns
void
Returns
this
on
on
<
K
>
(
event
,
listener
)
:
this
Type Parameters
K
extends
keyof
ButtonEvents
Parameters
event
:
K
listener
:
(
(
data
:
ButtonEvents
[
K
]
)
=>
void
)
(
data
)
:
void
Parameters
data
:
ButtonEvents
[
K
]
Returns
void
Returns
this
once
once
<
K
>
(
event
,
listener
)
:
this
Type Parameters
K
extends
keyof
ButtonEvents
Parameters
event
:
K
listener
:
(
(
data
:
ButtonEvents
[
K
]
)
=>
void
)
(
data
)
:
void
Parameters
data
:
ButtonEvents
[
K
]
Returns
void
Returns
this
prepend
Listener
prepend
Listener
<
K
>
(
event
,
listener
)
:
this
Type Parameters
K
extends
keyof
ButtonEvents
Parameters
event
:
K
listener
:
(
(
data
:
ButtonEvents
[
K
]
)
=>
void
)
(
data
)
:
void
Parameters
data
:
ButtonEvents
[
K
]
Returns
void
Returns
this
prepend
Once
Listener
prepend
Once
Listener
<
K
>
(
event
,
listener
)
:
this
Type Parameters
K
extends
keyof
ButtonEvents
Parameters
event
:
K
listener
:
(
(
data
:
ButtonEvents
[
K
]
)
=>
void
)
(
data
)
:
void
Parameters
data
:
ButtonEvents
[
K
]
Returns
void
Returns
this
raw
Listeners
raw
Listeners
<
K
>
(
event
)
:
Function
[]
Type Parameters
K
extends
keyof
ButtonEvents
Parameters
event
:
K
Returns
Function
[]
read
ButtonAState
read
ButtonAState
(
)
:
Promise
<
ButtonState
>
Read state of button A
Returns
Promise
<
ButtonState
>
read
ButtonBState
read
ButtonBState
(
)
:
Promise
<
ButtonState
>
Read state of button B
Returns
Promise
<
ButtonState
>
remove
All
Listeners
remove
All
Listeners
<
K
>
(
event
?
)
:
this
Type Parameters
K
extends
keyof
ButtonEvents
Parameters
Optional
event
:
K
Returns
this
remove
Event
Listener
remove
Event
Listener
<
K
>
(
type
,
callback
)
:
void
Type Parameters
K
extends
keyof
ButtonEvents
Parameters
type
:
K
callback
:
(
(
event
:
CustomEvent
<
ButtonEvents
[
K
]
>
)
=>
void
)
(
event
)
:
void
Parameters
event
:
CustomEvent
<
ButtonEvents
[
K
]
>
Returns
void
Returns
void
remove
Listener
remove
Listener
<
K
>
(
event
,
listener
)
:
this
Type Parameters
K
extends
keyof
ButtonEvents
Parameters
event
:
K
listener
:
(
(
data
:
ButtonEvents
[
K
]
)
=>
void
)
(
data
)
:
void
Parameters
data
:
ButtonEvents
[
K
]
Returns
void
Returns
this
set
Max
Listeners
set
Max
Listeners
(
n
)
:
this
Parameters
n
:
number
Returns
this
Settings
Member Visibility
Protected
Inherited
Theme
OS
Light
Dark
On This Page
Methods
add
Event
Listener
add
Listener
dispatch
Event
emit
event
Names
get
Max
Listeners
listener
Count
listeners
off
on
once
prepend
Listener
prepend
Once
Listener
raw
Listeners
read
ButtonAState
read
ButtonBState
remove
All
Listeners
remove
Event
Listener
remove
Listener
set
Max
Listeners
micro:bit Web Bluetooth API Documentation
Loading...
Button Service