DiscordAudioAttachment
Extends
Section titled “Extends”DiscordMediaLifecycle
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new DiscordAudioAttachment():
DiscordAudioAttachment
Returns
Section titled “Returns”DiscordAudioAttachment
Inherited from
Section titled “Inherited from”DiscordMediaLifecycle.constructor
The size of the audio file in bytes
Remarks
Section titled “Remarks”The unit is not automatically calculated, you should provide it manually through `bytesUnit`
Example
Section titled “Example”1024
bytesUnit
Section titled “bytesUnit”The unit of the audio file in a human-readable format
Example
Section titled “Example”'KB'
The URL to audio file
Example
Section titled “Example”'https://interactive-examples.mdn.mozilla.net/media/cc0-audio/t-rex-roar.mp3'
lightTheme
Section titled “lightTheme”Implementation of
Section titled “Implementation of”The name of the audio file
Remarks
Section titled “Remarks”Spaces will be replaced with underscores and any non-alphanumeric characters will be removed
lifecycle
Section titled “lifecycle”disconnectedCallback()
Section titled “disconnectedCallback()”disconnectedCallback():
void
Invoked when the component is removed from the document’s DOM.
This callback is the main signal to the element that it may no longer be
used. disconnectedCallback()
should ensure that nothing is holding a
reference to the element (such as event listeners added to nodes external
to the element), so that it is free to be garbage collected.
disconnectedCallback() { super.disconnectedCallback(); window.removeEventListener('keydown', this._handleKeydown);}
An element may be re-connected after being disconnected.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”DiscordMediaLifecycle.disconnectedCallback
updates
Section titled “updates”firstUpdated()
Section titled “firstUpdated()”firstUpdated(
changedProperties
):void
Invoked when the element is first updated. Implement to perform one time work on the element after update.
firstUpdated() { this.renderRoot.getElementById('my-text-area').focus();}
Setting properties inside this method will trigger the element to update again after this update cycle completes.
Parameters
Section titled “Parameters”changedProperties
Section titled “changedProperties”Map
<PropertyKey
, unknown
>
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”DiscordMediaLifecycle.firstUpdated
shouldUpdate()
Section titled “shouldUpdate()”shouldUpdate(
changedProperties
):boolean
Controls whether or not update()
should be called when the element requests
an update. By default, this method always returns true
, but this can be
customized to control when to update.
Parameters
Section titled “Parameters”changedProperties
Section titled “changedProperties”Map
<PropertyKey
, unknown
> | PropertyValueMap
<any
>
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”DiscordMediaLifecycle.shouldUpdate