Skip to content

Commit b7f3ebd

Browse files
robingenzclaude
andcommitted
style: place listener methods last in method ordering
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 2eae5f7 commit b7f3ebd

20 files changed

Lines changed: 437 additions & 437 deletions

File tree

packages/audio-session/README.md

Lines changed: 83 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,13 @@ const removeAllListeners = async () => {
169169

170170
<docgen-index>
171171

172-
* [`addListener('interruption', ...)`](#addlistenerinterruption-)
173-
* [`addListener('routeChange', ...)`](#addlistenerroutechange-)
174172
* [`configure(...)`](#configure)
175173
* [`getCurrentOutputs()`](#getcurrentoutputs)
176174
* [`overrideOutput(...)`](#overrideoutput)
177-
* [`removeAllListeners()`](#removealllisteners)
178175
* [`setActive(...)`](#setactive)
176+
* [`addListener('interruption', ...)`](#addlistenerinterruption-)
177+
* [`addListener('routeChange', ...)`](#addlistenerroutechange-)
178+
* [`removeAllListeners()`](#removealllisteners)
179179
* [Interfaces](#interfaces)
180180
* [Type Aliases](#type-aliases)
181181

@@ -184,50 +184,6 @@ const removeAllListeners = async () => {
184184
<docgen-api>
185185
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
186186

187-
### addListener('interruption', ...)
188-
189-
```typescript
190-
addListener(eventName: 'interruption', listenerFunc: (event: InterruptionEvent) => void) => Promise<PluginListenerHandle>
191-
```
192-
193-
Called when the audio session is interrupted, e.g. by an incoming phone call.
194-
195-
Only available on iOS.
196-
197-
| Param | Type |
198-
| ------------------ | ----------------------------------------------------------------------------------- |
199-
| **`eventName`** | <code>'interruption'</code> |
200-
| **`listenerFunc`** | <code>(event: <a href="#interruptionevent">InterruptionEvent</a>) =&gt; void</code> |
201-
202-
**Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
203-
204-
**Since:** 0.1.0
205-
206-
--------------------
207-
208-
209-
### addListener('routeChange', ...)
210-
211-
```typescript
212-
addListener(eventName: 'routeChange', listenerFunc: (event: RouteChangeEvent) => void) => Promise<PluginListenerHandle>
213-
```
214-
215-
Called when the audio route changes, e.g. when headphones are plugged in or out.
216-
217-
Only available on iOS.
218-
219-
| Param | Type |
220-
| ------------------ | --------------------------------------------------------------------------------- |
221-
| **`eventName`** | <code>'routeChange'</code> |
222-
| **`listenerFunc`** | <code>(event: <a href="#routechangeevent">RouteChangeEvent</a>) =&gt; void</code> |
223-
224-
**Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
225-
226-
**Since:** 0.1.0
227-
228-
--------------------
229-
230-
231187
### configure(...)
232188

233189
```typescript
@@ -283,72 +239,85 @@ Only available on iOS.
283239
--------------------
284240

285241

286-
### removeAllListeners()
242+
### setActive(...)
287243

288244
```typescript
289-
removeAllListeners() => Promise<void>
245+
setActive(options: SetActiveOptions) => Promise<void>
290246
```
291247

292-
Remove all listeners for this plugin.
248+
Activate or deactivate the audio session.
293249

294250
Only available on iOS.
295251

252+
| Param | Type |
253+
| ------------- | ------------------------------------------------------------- |
254+
| **`options`** | <code><a href="#setactiveoptions">SetActiveOptions</a></code> |
255+
296256
**Since:** 0.1.0
297257

298258
--------------------
299259

300260

301-
### setActive(...)
261+
### addListener('interruption', ...)
302262

303263
```typescript
304-
setActive(options: SetActiveOptions) => Promise<void>
264+
addListener(eventName: 'interruption', listenerFunc: (event: InterruptionEvent) => void) => Promise<PluginListenerHandle>
305265
```
306266

307-
Activate or deactivate the audio session.
267+
Called when the audio session is interrupted, e.g. by an incoming phone call.
308268

309269
Only available on iOS.
310270

311-
| Param | Type |
312-
| ------------- | ------------------------------------------------------------- |
313-
| **`options`** | <code><a href="#setactiveoptions">SetActiveOptions</a></code> |
271+
| Param | Type |
272+
| ------------------ | ----------------------------------------------------------------------------------- |
273+
| **`eventName`** | <code>'interruption'</code> |
274+
| **`listenerFunc`** | <code>(event: <a href="#interruptionevent">InterruptionEvent</a>) =&gt; void</code> |
275+
276+
**Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
314277

315278
**Since:** 0.1.0
316279

317280
--------------------
318281

319282

320-
### Interfaces
283+
### addListener('routeChange', ...)
321284

285+
```typescript
286+
addListener(eventName: 'routeChange', listenerFunc: (event: RouteChangeEvent) => void) => Promise<PluginListenerHandle>
287+
```
322288

323-
#### PluginListenerHandle
289+
Called when the audio route changes, e.g. when headphones are plugged in or out.
324290

325-
| Prop | Type |
326-
| ------------ | ----------------------------------------- |
327-
| **`remove`** | <code>() =&gt; Promise&lt;void&gt;</code> |
291+
Only available on iOS.
328292

293+
| Param | Type |
294+
| ------------------ | --------------------------------------------------------------------------------- |
295+
| **`eventName`** | <code>'routeChange'</code> |
296+
| **`listenerFunc`** | <code>(event: <a href="#routechangeevent">RouteChangeEvent</a>) =&gt; void</code> |
329297

330-
#### InterruptionEvent
298+
**Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
331299

332-
| Prop | Type | Description | Since |
333-
| ------------------ | ------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ----- |
334-
| **`shouldResume`** | <code>boolean</code> | Whether playback should resume after the interruption ended. Only `true` if `type` is `ended`. | 0.1.0 |
335-
| **`type`** | <code><a href="#interruptiontype">InterruptionType</a></code> | The type of the interruption. | 0.1.0 |
300+
**Since:** 0.1.0
336301

302+
--------------------
337303

338-
#### RouteChangeEvent
339304

340-
| Prop | Type | Description | Since |
341-
| ------------- | --------------------------------------------------------------- | ------------------------------------------------------ | ----- |
342-
| **`outputs`** | <code>AudioSessionOutput[]</code> | The audio outputs of the audio route after the change. | 0.1.0 |
343-
| **`reason`** | <code><a href="#routechangereason">RouteChangeReason</a></code> | The reason why the audio route changed. | 0.1.0 |
305+
### removeAllListeners()
344306

307+
```typescript
308+
removeAllListeners() => Promise<void>
309+
```
345310

346-
#### AudioSessionOutput
311+
Remove all listeners for this plugin.
347312

348-
| Prop | Type | Description | Since |
349-
| -------------- | ------------------- | ------------------------------------------------- | ----- |
350-
| **`portName`** | <code>string</code> | The human-readable name of the audio output port. | 0.1.0 |
351-
| **`portType`** | <code>string</code> | The type of the audio output port. | 0.1.0 |
313+
Only available on iOS.
314+
315+
**Since:** 0.1.0
316+
317+
--------------------
318+
319+
320+
### Interfaces
352321

353322

354323
#### ConfigureOptions
@@ -380,6 +349,14 @@ Only available on iOS.
380349
| **`outputs`** | <code>AudioSessionOutput[]</code> | The audio outputs of the current audio route. | 0.1.0 |
381350

382351

352+
#### AudioSessionOutput
353+
354+
| Prop | Type | Description | Since |
355+
| -------------- | ------------------- | ------------------------------------------------- | ----- |
356+
| **`portName`** | <code>string</code> | The human-readable name of the audio output port. | 0.1.0 |
357+
| **`portType`** | <code>string</code> | The type of the audio output port. | 0.1.0 |
358+
359+
383360
#### OverrideOutputOptions
384361

385362
| Prop | Type | Description | Since |
@@ -395,21 +372,30 @@ Only available on iOS.
395372
| **`notifyOthersOnDeactivation`** | <code>boolean</code> | Whether other audio sessions are notified when this session is deactivated, so they can resume playback. | <code>true</code> | 0.1.0 |
396373

397374

398-
### Type Aliases
375+
#### PluginListenerHandle
399376

377+
| Prop | Type |
378+
| ------------ | ----------------------------------------- |
379+
| **`remove`** | <code>() =&gt; Promise&lt;void&gt;</code> |
400380

401-
#### InterruptionType
402381

403-
The type of an audio session interruption.
382+
#### InterruptionEvent
404383

405-
<code>'began' | 'ended'</code>
384+
| Prop | Type | Description | Since |
385+
| ------------------ | ------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ----- |
386+
| **`shouldResume`** | <code>boolean</code> | Whether playback should resume after the interruption ended. Only `true` if `type` is `ended`. | 0.1.0 |
387+
| **`type`** | <code><a href="#interruptiontype">InterruptionType</a></code> | The type of the interruption. | 0.1.0 |
406388

407389

408-
#### RouteChangeReason
390+
#### RouteChangeEvent
409391

410-
The reason why the audio route changed.
392+
| Prop | Type | Description | Since |
393+
| ------------- | --------------------------------------------------------------- | ------------------------------------------------------ | ----- |
394+
| **`outputs`** | <code>AudioSessionOutput[]</code> | The audio outputs of the audio route after the change. | 0.1.0 |
395+
| **`reason`** | <code><a href="#routechangereason">RouteChangeReason</a></code> | The reason why the audio route changed. | 0.1.0 |
411396

412-
<code>'categoryChange' | 'newDeviceAvailable' | 'noSuitableRouteForCategory' | 'oldDeviceUnavailable' | 'override' | 'routeConfigurationChange' | 'unknown' | 'wakeFromSleep'</code>
397+
398+
### Type Aliases
413399

414400

415401
#### AudioSessionCategory
@@ -432,6 +418,20 @@ The audio output port to route playback to.
432418

433419
<code>'default' | 'speaker'</code>
434420

421+
422+
#### InterruptionType
423+
424+
The type of an audio session interruption.
425+
426+
<code>'began' | 'ended'</code>
427+
428+
429+
#### RouteChangeReason
430+
431+
The reason why the audio route changed.
432+
433+
<code>'categoryChange' | 'newDeviceAvailable' | 'noSuitableRouteForCategory' | 'oldDeviceUnavailable' | 'override' | 'routeConfigurationChange' | 'unknown' | 'wakeFromSleep'</code>
434+
435435
</docgen-api>
436436

437437
## Session Ownership

packages/audio-session/src/definitions.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,67 +2,67 @@ import type { PluginListenerHandle } from '@capacitor/core';
22

33
export interface AudioSessionPlugin {
44
/**
5-
* Called when the audio session is interrupted, e.g. by an incoming phone call.
5+
* Configure the audio session category, mode and options.
66
*
77
* Only available on iOS.
88
*
99
* @since 0.1.0
1010
*/
11-
addListener(
12-
eventName: 'interruption',
13-
listenerFunc: (event: InterruptionEvent) => void,
14-
): Promise<PluginListenerHandle>;
11+
configure(options: ConfigureOptions): Promise<void>;
1512
/**
16-
* Called when the audio route changes, e.g. when headphones are plugged in or out.
13+
* Get the audio outputs of the current audio route.
1714
*
1815
* Only available on iOS.
1916
*
2017
* @since 0.1.0
2118
*/
22-
addListener(
23-
eventName: 'routeChange',
24-
listenerFunc: (event: RouteChangeEvent) => void,
25-
): Promise<PluginListenerHandle>;
19+
getCurrentOutputs(): Promise<GetCurrentOutputsResult>;
2620
/**
27-
* Configure the audio session category, mode and options.
21+
* Override the audio output port that is used for playback.
2822
*
2923
* Only available on iOS.
3024
*
3125
* @since 0.1.0
3226
*/
33-
configure(options: ConfigureOptions): Promise<void>;
27+
overrideOutput(options: OverrideOutputOptions): Promise<void>;
3428
/**
35-
* Get the audio outputs of the current audio route.
29+
* Activate or deactivate the audio session.
3630
*
3731
* Only available on iOS.
3832
*
3933
* @since 0.1.0
4034
*/
41-
getCurrentOutputs(): Promise<GetCurrentOutputsResult>;
35+
setActive(options: SetActiveOptions): Promise<void>;
4236
/**
43-
* Override the audio output port that is used for playback.
37+
* Called when the audio session is interrupted, e.g. by an incoming phone call.
4438
*
4539
* Only available on iOS.
4640
*
4741
* @since 0.1.0
4842
*/
49-
overrideOutput(options: OverrideOutputOptions): Promise<void>;
43+
addListener(
44+
eventName: 'interruption',
45+
listenerFunc: (event: InterruptionEvent) => void,
46+
): Promise<PluginListenerHandle>;
5047
/**
51-
* Remove all listeners for this plugin.
48+
* Called when the audio route changes, e.g. when headphones are plugged in or out.
5249
*
5350
* Only available on iOS.
5451
*
5552
* @since 0.1.0
5653
*/
57-
removeAllListeners(): Promise<void>;
54+
addListener(
55+
eventName: 'routeChange',
56+
listenerFunc: (event: RouteChangeEvent) => void,
57+
): Promise<PluginListenerHandle>;
5858
/**
59-
* Activate or deactivate the audio session.
59+
* Remove all listeners for this plugin.
6060
*
6161
* Only available on iOS.
6262
*
6363
* @since 0.1.0
6464
*/
65-
setActive(options: SetActiveOptions): Promise<void>;
65+
removeAllListeners(): Promise<void>;
6666
}
6767

6868
/**

0 commit comments

Comments
 (0)