web: Fix deprecation warnings
This commit is contained in:
parent
0ac25b5808
commit
d824a02664
|
@ -12,7 +12,7 @@ use tracing_subscriber::layer::Layered;
|
|||
use tracing_subscriber::Registry;
|
||||
use tracing_wasm::WASMLayer;
|
||||
use wasm_bindgen::prelude::*;
|
||||
use web_sys::AudioContext;
|
||||
use web_sys::{AudioContext, AudioScheduledSourceNode};
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub struct WebAudioBackend {
|
||||
|
@ -230,7 +230,8 @@ impl Buffer {
|
|||
audio_node
|
||||
.connect_with_audio_node(&self.context.destination())
|
||||
.into_js_result()?;
|
||||
audio_node.set_onended(Some(self.on_ended_handler.as_ref().unchecked_ref()));
|
||||
let scheduled: &AudioScheduledSourceNode = &audio_node;
|
||||
scheduled.set_onended(Some(self.on_ended_handler.as_ref().unchecked_ref()));
|
||||
|
||||
// Sanity: ensure our player time is not in the past. This can happen due to underruns.
|
||||
self.time
|
||||
|
@ -250,7 +251,8 @@ impl Buffer {
|
|||
impl Drop for Buffer {
|
||||
fn drop(&mut self) {
|
||||
if let Some(audio_node) = self.audio_node.take() {
|
||||
audio_node.set_onended(None);
|
||||
let scheduled: &AudioScheduledSourceNode = &audio_node;
|
||||
scheduled.set_onended(None);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,13 +78,14 @@ impl<E: FromWasmAbi + 'static> JsCallback<E> {
|
|||
let target = target.as_ref();
|
||||
let closure = Closure::new(closure);
|
||||
|
||||
let options = AddEventListenerOptions::new();
|
||||
options.set_passive(false);
|
||||
options.set_capture(is_capture);
|
||||
target
|
||||
.add_event_listener_with_callback_and_add_event_listener_options(
|
||||
name,
|
||||
closure.as_ref().unchecked_ref(),
|
||||
AddEventListenerOptions::new()
|
||||
.passive(false)
|
||||
.capture(is_capture),
|
||||
&options,
|
||||
)
|
||||
.warn_on_error();
|
||||
|
||||
|
|
|
@ -269,15 +269,17 @@ impl NavigatorBackend for WebNavigatorBackend {
|
|||
};
|
||||
|
||||
Box::pin(async move {
|
||||
let mut init = RequestInit::new();
|
||||
let init = RequestInit::new();
|
||||
|
||||
init.method(&request.method().to_string());
|
||||
init.credentials(credentials);
|
||||
init.set_method(&request.method().to_string());
|
||||
init.set_credentials(credentials);
|
||||
|
||||
if let Some((data, mime)) = request.body() {
|
||||
let options = BlobPropertyBag::new();
|
||||
options.set_type(mime);
|
||||
let blob = Blob::new_with_buffer_source_sequence_and_options(
|
||||
&Array::from_iter([Uint8Array::from(data.as_slice()).buffer()]),
|
||||
BlobPropertyBag::new().type_(mime),
|
||||
&options,
|
||||
)
|
||||
.map_err(|_| ErrorResponse {
|
||||
url: url.to_string(),
|
||||
|
@ -289,7 +291,7 @@ impl NavigatorBackend for WebNavigatorBackend {
|
|||
error: Error::FetchError("Got JS error".to_string()),
|
||||
})?;
|
||||
|
||||
init.body(Some(&blob));
|
||||
init.set_body(&blob);
|
||||
}
|
||||
|
||||
let web_request = match WebRequest::new_with_str_and_init(url.as_str(), &init) {
|
||||
|
|
Loading…
Reference in New Issue