3
0
mirror of https://github.com/danielsogl/awesome-cordova-plugins.git synced 2025-03-13 14:21:04 +08:00

chore(media): remove unused import, ensure plugin is installed

This commit is contained in:
Ibby 2016-10-01 15:19:16 -04:00
parent 58a99a14d5
commit 96bb4d38dc

@ -1,6 +1,4 @@
import { CordovaInstance, Plugin } from './plugin'; import {CordovaInstance, Plugin, getPlugin, pluginWarn} from './plugin';
import { Observable } from 'rxjs/Observable';
declare var Media: any; declare var Media: any;
@ -69,11 +67,12 @@ export interface MediaError {
* *
* ``` * ```
*/ */
@Plugin({ let pluginMeta = {
repo: 'https://github.com/apache/cordova-plugin-media', repo: 'https://github.com/apache/cordova-plugin-media',
plugin: 'cordova-plugin-media', plugin: 'cordova-plugin-media',
pluginRef: 'Media' pluginRef: 'Media'
}) };
@Plugin(pluginMeta)
export class MediaPlugin { export class MediaPlugin {
// Constants // Constants
@ -127,9 +126,13 @@ export class MediaPlugin {
* @param onStatusUpdate {Function} A callback function to be invoked when the status of the file changes * @param onStatusUpdate {Function} A callback function to be invoked when the status of the file changes
*/ */
constructor(src: string, onStatusUpdate?: Function) { constructor(src: string, onStatusUpdate?: Function) {
this.init = new Promise<any>((resolve, reject) => { if (!!getPlugin('Media')) {
this._objectInstance = new Media(src, resolve, reject, onStatusUpdate); this.init = new Promise<any>((resolve, reject) => {
}); this._objectInstance = new Media(src, resolve, reject, onStatusUpdate);
});
} else {
pluginWarn(pluginMeta);
}
} }
/** /**