@types/chrome 0.0.275 → 0.0.276

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. chrome/README.md +1 -1
  2. chrome/index.d.ts +155 -0
  3. chrome/package.json +2 -2
chrome/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for chrome (http://developer.chrome.com/e
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/chrome.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Wed, 02 Oct 2024 19:07:20 GMT
11
+ * Last updated: Thu, 03 Oct 2024 06:10:42 GMT
12
12
  * Dependencies: [@types/filesystem](https://npmjs.com/package/@types/filesystem), [@types/har-format](https://npmjs.com/package/@types/har-format)
13
13
 
14
14
  # Credits
chrome/index.d.ts CHANGED
@@ -486,6 +486,160 @@ declare namespace chrome.alarms {
486
486
  export var onAlarm: AlarmEvent;
487
487
  }
488
488
 
489
+ ////////////////////
490
+ // Audio
491
+ ////////////////////
492
+ /**
493
+ * The chrome.audio API is provided to allow users to get information about and control the audio devices attached to the system.
494
+ * This API is currently only available in kiosk mode for ChromeOS.
495
+ *
496
+ * Permissions: "audio"
497
+ *
498
+ * @platform ChromeOS only
499
+ * @since Chrome 59
500
+ */
501
+ declare namespace chrome.audio {
502
+ export interface AudioDeviceInfo {
503
+ /** Device name */
504
+ deviceName: string;
505
+ /** Type of the device */
506
+ deviceType: DeviceType;
507
+ /** The user-friendly name (e.g. "USB Microphone"). */
508
+ displayName: string;
509
+ /** The unique identifier of the audio device. */
510
+ id: string;
511
+ /** True if this is the current active device. */
512
+ isActive: boolean;
513
+ /** The sound level of the device, volume for output, gain for input. */
514
+ level: number;
515
+ /** The stable/persisted device id string when available. */
516
+ stableDeviceId?: string;
517
+ /** Stream type associated with this device. */
518
+ streamType: StreamType;
519
+ }
520
+
521
+ export interface DeviceFilter {
522
+ /** If set, only audio devices whose active state matches this value will satisfy the filter. */
523
+ isActive?: boolean;
524
+ /** If set, only audio devices whose stream type is included in this list will satisfy the filter. */
525
+ streamTypes?: StreamType[];
526
+ }
527
+
528
+ export interface DeviceIdLists {
529
+ /**
530
+ * List of input devices specified by their ID.
531
+ * To indicate input devices should be unaffected, leave this property unset.
532
+ */
533
+ input?: string[];
534
+ /**
535
+ * List of output devices specified by their ID.
536
+ * To indicate output devices should be unaffected, leave this property unset.
537
+ */
538
+ output?: string[];
539
+ }
540
+
541
+ export interface DeviceProperties {
542
+ /**
543
+ * The audio device's desired sound level. Defaults to the device's current sound level.
544
+ * If used with audio input device, represents audio device gain.
545
+ * If used with audio output device, represents audio device volume.
546
+ */
547
+ level?: number;
548
+ }
549
+
550
+ /** Available audio device types. */
551
+ export enum DeviceType {
552
+ ALSA_LOOPBACK = "ALSA_LOOPBACK",
553
+ BLUETOOTH = "BLUETOOTH",
554
+ FRONT_MIC = "FRONT_MIC",
555
+ HDMI = "HDMI",
556
+ HEADPHONE = "HEADPHONE",
557
+ HOTWORD = "HOTWORD",
558
+ INTERNAL_MIC = "INTERNAL_MIC",
559
+ INTERNAL_SPEAKER = "INTERNAL_SPEAKER",
560
+ KEYBOARD_MIC = "KEYBOARD_MIC",
561
+ LINEOUT = "LINEOUT",
562
+ MIC = "MIC",
563
+ OTHER = "OTHER",
564
+ POST_DSP_LOOPBACK = "POST_DSP_LOOPBACK",
565
+ POST_MIX_LOOPBACK = "POST_MIX_LOOPBACK",
566
+ REAR_MIC = "REAR_MIC",
567
+ USB = "USB",
568
+ }
569
+
570
+ export interface LevelChangedEvent {
571
+ /** ID of device whose sound level has changed. */
572
+ deviceId: string;
573
+ /** The device's new sound level. */
574
+ level: number;
575
+ }
576
+
577
+ export interface MuteChangedEvent {
578
+ /** Whether or not the stream is now muted. */
579
+ isMuted: boolean;
580
+ /** The type of the stream for which the mute value changed. The updated mute value applies to all devices with this stream type. */
581
+ streamType: StreamType;
582
+ }
583
+
584
+ /** Type of stream an audio device provides. */
585
+ export enum StreamType {
586
+ INPUT = "INPUT",
587
+ OUTPUT = "OUTPUT",
588
+ }
589
+
590
+ /**
591
+ * Gets a list of audio devices filtered based on filter.
592
+ * Can return its result via Promise in Manifest V3 or later since Chrome 116.
593
+ */
594
+ export function getDevices(filter?: DeviceFilter): Promise<AudioDeviceInfo[]>;
595
+ export function getDevices(filter: DeviceFilter, callback: (devices: AudioDeviceInfo[]) => void): void;
596
+ export function getDevices(callback: (devices: AudioDeviceInfo[]) => void): void;
597
+
598
+ /**
599
+ * Gets the system-wide mute state for the specified stream type.
600
+ * Can return its result via Promise in Manifest V3 or later since Chrome 116.
601
+ */
602
+ export function getMute(streamType: `${StreamType}`): Promise<boolean>;
603
+ export function getMute(streamType: `${StreamType}`, callback: (value: boolean) => void): void;
604
+
605
+ /**
606
+ * Sets lists of active input and/or output devices.
607
+ * Can return its result via Promise in Manifest V3 or later since Chrome 116.
608
+ */
609
+ export function setActiveDevices(ids: DeviceIdLists): Promise<void>;
610
+ export function setActiveDevices(ids: DeviceIdLists, callback: () => void): void;
611
+
612
+ /**
613
+ * Sets mute state for a stream type. The mute state will apply to all audio devices with the specified audio stream type.
614
+ * Can return its result via Promise in Manifest V3 or later since Chrome 116.
615
+ */
616
+ export function setMute(streamType: `${StreamType}`, isMuted: boolean): Promise<void>;
617
+ export function setMute(streamType: `${StreamType}`, isMuted: boolean, callback: () => void): void;
618
+
619
+ /**
620
+ * Sets the properties for the input or output device.
621
+ * Can return its result via Promise in Manifest V3 or later since Chrome 116.
622
+ */
623
+ export function setProperties(id: string, properties: DeviceProperties): Promise<void>;
624
+ export function setProperties(id: string, properties: DeviceProperties, callback: () => void): void;
625
+
626
+ /**
627
+ * Fired when audio devices change, either new devices being added, or existing devices being removed.
628
+ */
629
+ export const onDeviceListChanged: chrome.events.Event<(devices: AudioDeviceInfo[]) => void>;
630
+
631
+ /**
632
+ * Fired when sound level changes for an active audio device.
633
+ */
634
+ export const onLevelChanged: chrome.events.Event<(event: LevelChangedEvent) => void>;
635
+
636
+ /**
637
+ * Fired when the mute state of the audio input or output changes.
638
+ * Note that mute state is system-wide and the new value applies to every audio device with specified stream type.
639
+ */
640
+ export const onMuteChanged: chrome.events.Event<(event: MuteChangedEvent) => void>;
641
+ }
642
+
489
643
  ////////////////////
490
644
  // Browser
491
645
  ////////////////////
@@ -7464,6 +7618,7 @@ declare namespace chrome.runtime {
7464
7618
  export type ManifestPermissions =
7465
7619
  | "activeTab"
7466
7620
  | "alarms"
7621
+ | "audio"
7467
7622
  | "background"
7468
7623
  | "bookmarks"
7469
7624
  | "browsingData"
chrome/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/chrome",
3
- "version": "0.0.275",
3
+ "version": "0.0.276",
4
4
  "description": "TypeScript definitions for chrome",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/chrome",
6
6
  "license": "MIT",
@@ -93,6 +93,6 @@
93
93
  "@types/filesystem": "*",
94
94
  "@types/har-format": "*"
95
95
  },
96
- "typesPublisherContentHash": "28d212168a740540fced1a60a357c40d3a3e5535e79e56f6ce810482806f9b37",
96
+ "typesPublisherContentHash": "cab771353bda4e0ddf6c12acf47fab033aa50196f074a7329164cb7a907fee27",
97
97
  "typeScriptVersion": "4.8"
98
98
  }