mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-17 07:20:23 +00:00
[clovelced-plugin-audiomanagement] Add types
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import * as AudioManagement from 'clovelced-plugin-audiomanagement';
|
||||
|
||||
AudioManagement.setAudioMode(AudioManagement.AudioMode.NORMAL, () => {
|
||||
}, (error: any) => {
|
||||
});
|
||||
|
||||
AudioManagement.getAudioMode((results) => {
|
||||
results.audioMode;
|
||||
results.label;
|
||||
}, (error: any) => {
|
||||
});
|
||||
|
||||
AudioManagement.setVolume(AudioManagement.VolumeType.MUSIC, 5, () => {
|
||||
}, (error: any) => {
|
||||
});
|
||||
|
||||
AudioManagement.getVolume(AudioManagement.VolumeType.NOTIFICATION, (results) => {
|
||||
results.volume;
|
||||
}, (error: any) => {
|
||||
});
|
||||
|
||||
AudioManagement.getMaxVolume(AudioManagement.VolumeType.RING, (results) => {
|
||||
results.maxVolume;
|
||||
}, (error: any) => {
|
||||
});
|
||||
|
||||
AudioManagement.AudioMode.SILENT;
|
||||
AudioManagement.AudioMode.VIBRATE;
|
||||
AudioManagement.VolumeType.SYSTEM;
|
||||
@@ -0,0 +1,67 @@
|
||||
// Type definitions for clovelced-plugin-audiomanagement 1.0
|
||||
// Project: https://github.com/clovelCed/cordova-plugin-audiomanagement#readme
|
||||
// Definitions by: Marc Kassay <https://github.com/marckassay>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export enum AudioMode {
|
||||
SILENT = 0,
|
||||
VIBRATE,
|
||||
NORMAL
|
||||
}
|
||||
|
||||
export enum VolumeType {
|
||||
RING = 0,
|
||||
MUSIC,
|
||||
NOTIFICATION,
|
||||
SYSTEM
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the `AudioManagement.AudioMode` for the device.
|
||||
*
|
||||
* @param mode the device can be set to: Silent, Normal, Vibrate
|
||||
* @param onSuccess a callback when setting succeeds.
|
||||
* @param onError a callback when setting fails.
|
||||
* @returns void
|
||||
*/
|
||||
export function setAudioMode(mode: AudioMode, onSuccess: () => void, onError: (error: any) => void): void;
|
||||
|
||||
/**
|
||||
* Gets the current `AudioManagement.AudioMode` of the device.
|
||||
*
|
||||
* @param onSuccess a callback when succeeds with an object with `label` and `audioMode` properties.
|
||||
* @param onError a callback when getting fails.
|
||||
* @returns void
|
||||
*/
|
||||
export function getAudioMode(onSuccess: (results: { audioMode: AudioMode, label: string }) => void, onError: (error: any) => void): void;
|
||||
|
||||
/**
|
||||
* Sets the specified `AudioManagement.VolumeType` for the device with the value from `volume`.
|
||||
*
|
||||
* @param type the `AudioManagement.VolumeType` to set
|
||||
* @param volume the volume value
|
||||
* @param onSuccess a callback when setting succeeds.
|
||||
* @param onError a callback when setting fails.
|
||||
* @returns void
|
||||
*/
|
||||
export function setVolume(type: VolumeType, volume: number, onSuccess: () => void, onError: (error: any) => void): void;
|
||||
|
||||
/**
|
||||
* Gets the specified `AudioManagement.VolumeType`'s `volume`.
|
||||
*
|
||||
* @param type the `AudioManagement.VolumeType` to get
|
||||
* @param onSuccess a callback when getting succeeds with an object with numeric `volume` property.
|
||||
* @param onError a callback when getting fails.
|
||||
* @returns void
|
||||
*/
|
||||
export function getVolume(type: VolumeType, onSuccess: (results: { volume: number }) => void, onError: (error: any) => void): void;
|
||||
|
||||
/**
|
||||
* Gets the specified `AudioManagement.VolumeType`'s maximum `volume` that the device is currently set to.
|
||||
*
|
||||
* @param type the `AudioManagement.VolumeType` to get
|
||||
* @param onSuccess a callback when getting succeeds with an object with numeric `maxVolume` property.
|
||||
* @param onError a callback when getting fails.
|
||||
* @returns void
|
||||
*/
|
||||
export function getMaxVolume(type: VolumeType, onSuccess: (results: { maxVolume: number }) => void, onError: (error: any) => void): void;
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"clovelced-plugin-audiomanagement-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Reference in New Issue
Block a user