[common] fix linting error with undefined MediaError

Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/commit/341b3f47
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/341b3f47
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/341b3f47

Branch: refs/heads/master
Commit: 341b3f4707e77550d28b8292ec75e2d5b8d1bfc5
Parents: e8e2837
Author: Jesse MacFadyen <purplecabb...@gmail.com>
Authored: Tue Oct 9 17:50:07 2012 -0700
Committer: Jesse MacFadyen <purplecabb...@gmail.com>
Committed: Tue Oct 9 17:50:07 2012 -0700

----------------------------------------------------------------------
 lib/common/plugin/MediaError.js |   21 ++++++++++++---------
 1 files changed, 12 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/341b3f47/lib/common/plugin/MediaError.js
----------------------------------------------------------------------
diff --git a/lib/common/plugin/MediaError.js b/lib/common/plugin/MediaError.js
index 53f40dd..38002ac 100644
--- a/lib/common/plugin/MediaError.js
+++ b/lib/common/plugin/MediaError.js
@@ -33,20 +33,23 @@ we should simply use a literal :
     errorCallbackFunction( {'code':3} );
  */
 
-if(!MediaError) {
-    var MediaError = function(code, msg) {
+ var _MediaError = window.MediaError;
+
+
+if(!_MediaError) {
+    window.MediaError = _MediaError = function(code, msg) {
         this.code = (typeof code != 'undefined') ? code : null;
         this.message = msg || ""; // message is NON-standard! do not use!
     };
 }
 
-MediaError.MEDIA_ERR_NONE_ACTIVE    = MediaError.MEDIA_ERR_NONE_ACTIVE    || 0;
-MediaError.MEDIA_ERR_ABORTED        = MediaError.MEDIA_ERR_ABORTED        || 1;
-MediaError.MEDIA_ERR_NETWORK        = MediaError.MEDIA_ERR_NETWORK        || 2;
-MediaError.MEDIA_ERR_DECODE         = MediaError.MEDIA_ERR_DECODE         || 3;
-MediaError.MEDIA_ERR_NONE_SUPPORTED = MediaError.MEDIA_ERR_NONE_SUPPORTED || 4;
+_MediaError.MEDIA_ERR_NONE_ACTIVE    = _MediaError.MEDIA_ERR_NONE_ACTIVE    || 
0;
+_MediaError.MEDIA_ERR_ABORTED        = _MediaError.MEDIA_ERR_ABORTED        || 
1;
+_MediaError.MEDIA_ERR_NETWORK        = _MediaError.MEDIA_ERR_NETWORK        || 
2;
+_MediaError.MEDIA_ERR_DECODE         = _MediaError.MEDIA_ERR_DECODE         || 
3;
+_MediaError.MEDIA_ERR_NONE_SUPPORTED = _MediaError.MEDIA_ERR_NONE_SUPPORTED || 
4;
 // TODO: MediaError.MEDIA_ERR_NONE_SUPPORTED is legacy, the W3 spec now 
defines it as below.
 // as defined by 
http://dev.w3.org/html5/spec-author-view/video.html#error-codes
-MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED = 
MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED || 4;
+_MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED = 
_MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED || 4;
 
-module.exports = MediaError;
+module.exports = _MediaError;

Reply via email to