pub struct BaseAudioContext(/* private fields */);
Implementations§
Source§impl BaseAudioContext
impl BaseAudioContext
pub fn create_wave_shaper(&self) -> WaveShaperNode
pub fn create_stereo_panner(&self) -> StereoPannerNode
pub fn create_panner(&self) -> PannerNode
pub fn create_oscillator(&self) -> OscillatorNode
pub fn create_gain(&self) -> GainNode
pub fn create_dynamics_compressor(&self) -> DynamicsCompressorNode
pub fn create_convolver(&self) -> ConvolverNode
pub fn create_constant_source(&self) -> ConstantSourceNode
pub fn create_buffer_source(&self) -> AudioBufferSourceNode
pub fn create_biquad_filter(&self) -> BiquadFilterNode
pub fn create_analyser(&self) -> AnalyserNode
pub fn new(browser: &Browser) -> BaseAudioContext
pub fn create_delay( &self, maxDelayTime: &dyn ToJs<JsNullable<JsNumber>>, ) -> DelayNode
pub fn create_channel_splitter( &self, numberOfOutputs: &dyn ToJs<JsNullable<JsNumber>>, ) -> ChannelSplitterNode
pub fn create_channel_merger( &self, numberOfInputs: &dyn ToJs<JsNullable<JsNumber>>, ) -> ChannelMergerNode
pub fn create_iirfilter( &self, feedforward: &dyn ToJs<Array<JsNumber>>, feedback: &dyn ToJs<Array<JsNumber>>, ) -> IIRFilterNode
pub fn remove_event_listener( &self, type_: &dyn ToJs<JsString>, listener: &dyn ToJs<JsValue>, options: &dyn ToJs<JsNullable<JsValue>>, ) -> JsNullish
pub fn add_event_listener( &self, type_: &dyn ToJs<JsString>, listener: &dyn ToJs<JsValue>, options: &dyn ToJs<JsNullable<JsValue>>, ) -> JsNullish
pub fn decode_audio_data( &self, audioData: &dyn ToJs<ArrayBuffer>, successCallback: &dyn ToJs<JsNullable<DecodeSuccessCallback>>, errorCallback: &dyn ToJs<JsNullable<DecodeErrorCallback>>, ) -> Promise<AudioBuffer>
pub fn create_script_processor( &self, bufferSize: &dyn ToJs<JsNullable<JsNumber>>, numberOfInputChannels: &dyn ToJs<JsNullable<JsNumber>>, numberOfOutputChannels: &dyn ToJs<JsNullable<JsNumber>>, ) -> ScriptProcessorNode
pub fn create_periodic_wave( &self, real: &dyn ToJs<JsValue>, imag: &dyn ToJs<JsValue>, constraints: &dyn ToJs<JsNullable<PeriodicWaveConstraints>>, ) -> PeriodicWave
pub fn create_buffer( &self, numberOfChannels: &dyn ToJs<JsNumber>, length: &dyn ToJs<JsNumber>, sampleRate: &dyn ToJs<JsNumber>, ) -> AudioBuffer
pub fn get_state(&self) -> JsString
pub fn set_state(&self, value: &dyn ToJs<JsString>)
pub fn get_sample_rate(&self) -> JsNumber
pub fn set_sample_rate(&self, value: &dyn ToJs<JsNumber>)
pub fn get_onstatechange(&self) -> JsNullable<JsValue>
pub fn set_onstatechange(&self, value: &dyn ToJs<JsNullable<JsValue>>)
pub fn get_listener(&self) -> AudioListener
pub fn set_listener(&self, value: &AudioListener)
pub fn get_destination(&self) -> AudioDestinationNode
pub fn set_destination(&self, value: &AudioDestinationNode)
pub fn get_current_time(&self) -> JsNumber
pub fn set_current_time(&self, value: &dyn ToJs<JsNumber>)
pub fn get_audio_worklet(&self) -> AudioWorklet
pub fn set_audio_worklet(&self, value: &AudioWorklet)
pub fn get_prototype(browser: &Browser) -> BaseAudioContext
pub fn set_prototype(browser: &Browser, value: &BaseAudioContext)
Methods from Deref<Target = EventTarget>§
pub fn dispatch_event(&self, event: &Event) -> JsBoolean
pub fn remove_event_listener( &self, type_: &dyn ToJs<JsString>, callback: &dyn ToJs<JsNullable<JsValue>>, options: &dyn ToJs<JsNullable<JsValue>>, ) -> JsNullish
pub fn add_event_listener( &self, type_: &dyn ToJs<JsString>, callback: &dyn ToJs<JsNullable<JsValue>>, options: &dyn ToJs<JsNullable<JsValue>>, ) -> JsNullish
Methods from Deref<Target = JsObject>§
Sourcepub fn js_get_field(&self, property: &dyn UseInJsCode) -> JsValue
pub fn js_get_field(&self, property: &dyn UseInJsCode) -> JsValue
Get a field value of in this object.
WSDOM provides built-in getters so you should use that instead when possible.
Use js_get_field
only when needed
fn example(browser: Browser) {
// you can get `window["location"]["href"]` like this
let href: JsValue = wsdom::dom::location(&browser).js_get_field(&"href");
// but you should use built-in getters instead
let href: JsString = wsdom::dom::location(&browser).get_href();
}
Sourcepub fn js_set_field(&self, property: &dyn UseInJsCode, value: &dyn UseInJsCode)
pub fn js_set_field(&self, property: &dyn UseInJsCode, value: &dyn UseInJsCode)
Set a field value of in this object.
WSDOM provides built-in setters so you should use that instead when possible.
Use js_set_field
only when needed
fn example(browser: Browser) {
// you can set `window["location"]["href"]` like this
wsdom::dom::location(&browser).js_set_field(&"href", &"https://example.com/");
// but you should use built-in setters instead
wsdom::dom::location(&browser).set_href(&"https://example.com");
}
Sourcepub fn js_call_method<'a>(
&'a self,
method_name: &'a str,
args: impl IntoIterator<Item = &'a dyn UseInJsCode>,
last_arg_variadic: bool,
) -> JsValue
pub fn js_call_method<'a>( &'a self, method_name: &'a str, args: impl IntoIterator<Item = &'a dyn UseInJsCode>, last_arg_variadic: bool, ) -> JsValue
Call a method on this object.
Most types in WSDOM already come with safe Rust wrappers for their methods, so you should use those instead.
fn example(browser: &Browser) {
let console = wsdom::dom::console(browser);
// you can call console.log like this
console.js_call_method("log", [&"hello" as &_], false);
// but the better way is to use
wsdom::dom::console(&browser).log(&[&"Hello" as &_]);
}
Be aware that the first argument (method_name
) is NOT escaped.
Set last_arg_variadic
to true
if you want to “spread” the last argument as obj.method(arg1, arg2, ...arg3)
.
Sourcepub fn js_call_self<'a>(
&'a self,
args: impl IntoIterator<Item = &'a dyn UseInJsCode>,
last_arg_variadic: bool,
) -> JsValue
pub fn js_call_self<'a>( &'a self, args: impl IntoIterator<Item = &'a dyn UseInJsCode>, last_arg_variadic: bool, ) -> JsValue
Call this object: obj()
.
Most types in WSDOM already come with safe Rust wrappers for their methods, so you should use those instead.
Methods from Deref<Target = JsValue>§
pub fn browser(&self) -> &Browser
Sourcepub fn retrieve_json(&self) -> RetrieveFuture<'_, Value>
pub fn retrieve_json(&self) -> RetrieveFuture<'_, Value>
Retrive this value from the JS side to the Rust side. Returns Future whose output is a serde_json::Value.
§use wsdom::dom::Browser
§use wsdom::dom::HTMLInputElement;
async fn example(input: &HTMLInputElement) { let _val = input.get_value().retrieve_json().await; }
Trait Implementations§
Source§impl AsRef<BaseAudioContext> for AudioContext
impl AsRef<BaseAudioContext> for AudioContext
Source§fn as_ref(&self) -> &BaseAudioContext
fn as_ref(&self) -> &BaseAudioContext
Source§impl AsRef<BaseAudioContext> for BaseAudioContext
impl AsRef<BaseAudioContext> for BaseAudioContext
Source§impl AsRef<BaseAudioContext> for OfflineAudioContext
impl AsRef<BaseAudioContext> for OfflineAudioContext
Source§fn as_ref(&self) -> &BaseAudioContext
fn as_ref(&self) -> &BaseAudioContext
Source§impl AsRef<EventTarget> for BaseAudioContext
impl AsRef<EventTarget> for BaseAudioContext
Source§fn as_ref(&self) -> &EventTarget
fn as_ref(&self) -> &EventTarget
Source§impl AsRef<JsObject> for BaseAudioContext
impl AsRef<JsObject> for BaseAudioContext
Source§impl AsRef<JsValue> for BaseAudioContext
impl AsRef<JsValue> for BaseAudioContext
Source§impl Clone for BaseAudioContext
impl Clone for BaseAudioContext
Source§fn clone(&self) -> BaseAudioContext
fn clone(&self) -> BaseAudioContext
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more