capacitor-sound-effect
Advanced tools
Comparing version 1.0.1 to 2.0.1
@@ -1,6 +0,1 @@ | ||
declare module "@capacitor/core" { | ||
interface PluginRegistry { | ||
SoundEffect: SoundEffectPlugin; | ||
} | ||
} | ||
export interface SoundEffectPlugin { | ||
@@ -7,0 +2,0 @@ loadSound(options: { |
@@ -0,1 +1,2 @@ | ||
export {}; | ||
//# sourceMappingURL=definitions.js.map |
@@ -0,2 +1,4 @@ | ||
import type { SoundEffectPlugin } from './definitions'; | ||
declare const SoundEffect: SoundEffectPlugin; | ||
export * from './definitions'; | ||
export * from './web'; | ||
export { SoundEffect }; |
@@ -1,2 +0,7 @@ | ||
export * from './web'; | ||
import { registerPlugin } from '@capacitor/core'; | ||
const SoundEffect = registerPlugin('SoundEffect', { | ||
web: () => import('./web').then(m => new m.SoundEffectWeb()), | ||
}); | ||
export * from './definitions'; | ||
export { SoundEffect }; | ||
//# sourceMappingURL=index.js.map |
import { WebPlugin } from '@capacitor/core'; | ||
import { SoundEffectPlugin } from './definitions'; | ||
import type { SoundEffectPlugin } from './definitions'; | ||
export declare class SoundEffectWeb extends WebPlugin implements SoundEffectPlugin { | ||
@@ -14,3 +14,1 @@ private audioMap; | ||
} | ||
declare const SoundEffect: SoundEffectWeb; | ||
export { SoundEffect }; |
@@ -1,10 +0,1 @@ | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
import { WebPlugin } from '@capacitor/core'; | ||
@@ -19,22 +10,14 @@ export class SoundEffectWeb extends WebPlugin { | ||
} | ||
loadSound({ id, path }) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const audio = new Audio(); | ||
audio.setAttribute('src', path); | ||
audio.load(); | ||
this.audioMap[id] = audio; | ||
}); | ||
async loadSound({ id, path }) { | ||
const audio = new Audio(); | ||
audio.setAttribute('src', path); | ||
audio.load(); | ||
this.audioMap[id] = audio; | ||
} | ||
play({ id }) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const audio = this.audioMap[id]; | ||
if (audio) | ||
audio.play(); | ||
}); | ||
async play({ id }) { | ||
const audio = this.audioMap[id]; | ||
if (audio) | ||
audio.play(); | ||
} | ||
} | ||
const SoundEffect = new SoundEffectWeb(); | ||
export { SoundEffect }; | ||
import { registerWebPlugin } from '@capacitor/core'; | ||
registerWebPlugin(SoundEffect); | ||
//# sourceMappingURL=web.js.map |
{ | ||
"name": "capacitor-sound-effect", | ||
"version": "1.0.1", | ||
"version": "2.0.1", | ||
"description": "Native sound effects", | ||
"main": "dist/esm/index.js", | ||
"main": "dist/plugin.cjs.js", | ||
"module": "dist/esm/index.js", | ||
"types": "dist/esm/index.d.ts", | ||
"scripts": { | ||
"build": "npm run clean && tsc", | ||
"clean": "rm -rf ./dist", | ||
"watch": "tsc --watch", | ||
"prepublishOnly": "npm run build" | ||
}, | ||
"unpkg": "dist/plugin.js", | ||
"files": [ | ||
"android/src/main/", | ||
"android/build.gradle", | ||
"dist/", | ||
"ios/Plugin/", | ||
"CapacitorSoundEffect.podspec" | ||
], | ||
"author": "Vincent Velociter", | ||
"license": "MIT", | ||
"dependencies": { | ||
"@capacitor/core": "^2.4.7" | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/veloce/capacitor-sound-effect.git" | ||
}, | ||
"devDependencies": { | ||
"typescript": "^3.2.4", | ||
"@capacitor/ios": "^2.4.7", | ||
"@capacitor/android": "^2.4.7" | ||
"bugs": { | ||
"url": "https://github.com/veloce/capacitor-sound-effect/issues" | ||
}, | ||
"files": [ | ||
"dist/", | ||
"ios/", | ||
"android/", | ||
"CapacitorSoundEffect.podspec" | ||
], | ||
"keywords": [ | ||
@@ -34,2 +30,42 @@ "capacitor", | ||
], | ||
"scripts": { | ||
"verify": "npm run verify:ios && npm run verify:android && npm run verify:web", | ||
"verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin && cd ..", | ||
"verify:android": "cd android && ./gradlew clean build test && cd ..", | ||
"verify:web": "npm run build", | ||
"lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint", | ||
"fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- autocorrect --format", | ||
"eslint": "eslint . --ext ts", | ||
"prettier": "prettier \"**/*.{css,html,ts,js,java}\"", | ||
"swiftlint": "node-swiftlint", | ||
"docgen": "docgen --api SoundEffectPlugin --output-readme README.md --output-json dist/docs.json", | ||
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.js", | ||
"clean": "rimraf ./dist", | ||
"watch": "tsc --watch", | ||
"prepare": "npm run build" | ||
}, | ||
"devDependencies": { | ||
"@capacitor/android": "^3.0.0", | ||
"@capacitor/core": "^3.0.0", | ||
"@capacitor/docgen": "^0.0.10", | ||
"@capacitor/ios": "^3.0.0", | ||
"@ionic/eslint-config": "^0.3.0", | ||
"@ionic/prettier-config": "^1.0.1", | ||
"@ionic/swiftlint-config": "^1.1.2", | ||
"eslint": "^7.11.0", | ||
"prettier": "~2.2.0", | ||
"prettier-plugin-java": "~1.0.0", | ||
"rimraf": "^3.0.2", | ||
"rollup": "^2.32.0", | ||
"swiftlint": "^1.0.1", | ||
"typescript": "~4.0.3" | ||
}, | ||
"peerDependencies": { | ||
"@capacitor/core": "^3.0.0" | ||
}, | ||
"prettier": "@ionic/prettier-config", | ||
"swiftlint": "@ionic/swiftlint-config", | ||
"eslintConfig": { | ||
"extends": "@ionic/eslint-config/recommended" | ||
}, | ||
"capacitor": { | ||
@@ -42,10 +78,3 @@ "ios": { | ||
} | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/veloce/capacitor-sound-effect" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/veloce/capacitor-sound-effect/issues" | ||
} | ||
} |
@@ -1,9 +0,10 @@ | ||
# Capacitor Sound Effect | ||
# capacitor-sound-effect | ||
Capacitor plugin to play simple sound effects in your app. | ||
Native sound effects | ||
## Installation | ||
## Install | ||
``` | ||
```bash | ||
npm install capacitor-sound-effect | ||
npx cap sync | ||
``` | ||
@@ -13,15 +14,41 @@ | ||
| Method | Returns | | ||
| ------------------------------------------------ | --------------- | | ||
| loadSound(options: { id: string, path: string }) | `Promise<void>` | | ||
| play(options: { id: string }) | `Promise<void>` | | ||
<docgen-index> | ||
## Usage | ||
* [`loadSound(...)`](#loadsound) | ||
* [`play(...)`](#play) | ||
</docgen-index> | ||
<docgen-api> | ||
<!--Update the source file JSDoc comments and rerun docgen to update the docs below--> | ||
### loadSound(...) | ||
```typescript | ||
loadSound(options: { id: string; path: string; }) => any | ||
``` | ||
import { Plugins } from '@capacitor/core' | ||
Plugins.SoundEffect.loadSound({ id: 'mySound', path: `sounds/mySound.mp3` }) | ||
| Param | Type | | ||
| ------------- | ------------------------------------------ | | ||
| **`options`** | <code>{ id: string; path: string; }</code> | | ||
Plugins.SoundEffect.play({ id: 'mySound' }) | ||
**Returns:** <code>any</code> | ||
-------------------- | ||
### play(...) | ||
```typescript | ||
play(options: { id: string; }) => any | ||
``` | ||
| Param | Type | | ||
| ------------- | ---------------------------- | | ||
| **`options`** | <code>{ id: string; }</code> | | ||
**Returns:** <code>any</code> | ||
-------------------- | ||
</docgen-api> |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
164
54
21091
14
25
1
+ Added@capacitor/core@3.9.0(transitive)
+ Addedtslib@2.6.2(transitive)
- Removed@capacitor/core@^2.4.7
- Removed@capacitor/core@2.5.0(transitive)
- Removedtslib@1.14.1(transitive)