mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Add event target for bluetooth
This commit is contained in:
parent
b18ec28fa7
commit
d9c7ffb5b3
11 changed files with 111 additions and 19 deletions
|
@ -4,18 +4,20 @@
|
|||
|
||||
use dom::bindings::codegen::Bindings::BluetoothDeviceBinding;
|
||||
use dom::bindings::codegen::Bindings::BluetoothDeviceBinding::BluetoothDeviceMethods;
|
||||
use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull;
|
||||
use dom::bindings::js::{JS, Root, MutHeap, MutNullableHeap};
|
||||
use dom::bindings::reflector::{Reflectable, Reflector, reflect_dom_object};
|
||||
use dom::bindings::reflector::{Reflectable, reflect_dom_object};
|
||||
use dom::bindings::str::DOMString;
|
||||
use dom::bluetooth::Bluetooth;
|
||||
use dom::bluetoothadvertisingdata::BluetoothAdvertisingData;
|
||||
use dom::bluetoothremotegattserver::BluetoothRemoteGATTServer;
|
||||
use dom::eventtarget::EventTarget;
|
||||
use dom::globalscope::GlobalScope;
|
||||
|
||||
// https://webbluetoothcg.github.io/web-bluetooth/#bluetoothdevice
|
||||
#[dom_struct]
|
||||
pub struct BluetoothDevice {
|
||||
reflector_: Reflector,
|
||||
eventtarget: EventTarget,
|
||||
id: DOMString,
|
||||
name: Option<DOMString>,
|
||||
ad_data: MutHeap<JS<BluetoothAdvertisingData>>,
|
||||
|
@ -30,7 +32,7 @@ impl BluetoothDevice {
|
|||
context: &Bluetooth)
|
||||
-> BluetoothDevice {
|
||||
BluetoothDevice {
|
||||
reflector_: Reflector::new(),
|
||||
eventtarget: EventTarget::new_inherited(),
|
||||
id: id,
|
||||
name: name,
|
||||
ad_data: MutHeap::new(ad_data),
|
||||
|
@ -80,4 +82,7 @@ impl BluetoothDeviceMethods for BluetoothDevice {
|
|||
BluetoothRemoteGATTServer::new(&self.global(), self)
|
||||
})
|
||||
}
|
||||
|
||||
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothdeviceeventhandlers-ongattserverdisconnected
|
||||
event_handler!(gattserverdisconnected, GetOngattserverdisconnected, SetOngattserverdisconnected);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue