Use initialized input sources in getInputSources()

This commit is contained in:
Manish Goregaokar 2019-04-29 19:15:27 -07:00
parent 3a08e917e0
commit 5c8132c379
3 changed files with 19 additions and 1 deletions

View file

@ -926,7 +926,7 @@ impl VRDisplay {
/// Initialize XRInputSources
fn initialize_inputs(&self) {
if self.initialized_inputs.get() {
return
return;
}
self.initialized_inputs.set(true);
@ -955,6 +955,15 @@ impl VRDisplay {
Err(_) => {},
}
}
pub fn get_input_sources(&self) -> Vec<DomRoot<XRInputSource>> {
self.initialize_inputs();
self.input_sources
.borrow()
.iter()
.map(|(_, x)| DomRoot::from_ref(&**x))
.collect()
}
}
// WebVR Spec: If the number of values in the leftBounds/rightBounds arrays