Skip to content

Commit

Permalink
chore(media): remove unused import, ensure plugin is installed
Browse files Browse the repository at this point in the history
  • Loading branch information
ihadeed committed Oct 1, 2016
1 parent 58a99a1 commit 96bb4d3
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/plugins/media.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { CordovaInstance, Plugin } from './plugin';
import { Observable } from 'rxjs/Observable';

import {CordovaInstance, Plugin, getPlugin, pluginWarn} from './plugin';

declare var Media: any;

Expand Down Expand Up @@ -69,11 +67,12 @@ export interface MediaError {
*
* ```
*/
@Plugin({
let pluginMeta = {
repo: 'https://github.com/apache/cordova-plugin-media',
plugin: 'cordova-plugin-media',
pluginRef: 'Media'
})
};
@Plugin(pluginMeta)
export class MediaPlugin {

// Constants
Expand Down Expand Up @@ -127,9 +126,13 @@ export class MediaPlugin {
* @param onStatusUpdate {Function} A callback function to be invoked when the status of the file changes
*/
constructor(src: string, onStatusUpdate?: Function) {
this.init = new Promise<any>((resolve, reject) => {
this._objectInstance = new Media(src, resolve, reject, onStatusUpdate);
});
if (!!getPlugin('Media')) {
this.init = new Promise<any>((resolve, reject) => {
this._objectInstance = new Media(src, resolve, reject, onStatusUpdate);
});
} else {
pluginWarn(pluginMeta);
}
}

/**
Expand Down

0 comments on commit 96bb4d3

Please sign in to comment.