[#1016] Popcorn.defineProperty in core, because I wanted it to create a property for p.error to p.media.error.

This commit is contained in:
Scott Downe 2012-05-10 11:25:44 -04:00
Родитель 35cdabaa36
Коммит 83962b6847
2 изменённых файлов: 13 добавлений и 15 удалений

Просмотреть файл

@ -321,11 +321,8 @@
Popcorn.player.registry = {};
Popcorn.player.defineProperty = Object.defineProperty || function( object, description, options ) {
object.__defineGetter__( description, options.get || Popcorn.nop );
object.__defineSetter__( description, options.set || Popcorn.nop );
};
// legacy support for Popcorn.player.defineProperty
Popcorn.player.defineProperty = Popcorn.defineProperty;
// smart will attempt to find you a match, if it does not find a match,
// it will attempt to create a video element with the source,

Просмотреть файл

@ -288,17 +288,12 @@
}
};
var error = function() {
Popcorn.defineProperty( this, "error", {
get: function() {
self.media.removeEventListener( "error", error, false );
self.error = self.media.error;
};
// grab the error object if it already exists
this.error = this.media.error;
// listen for future errors and report on to the error object
this.media.addEventListener( "error", error, false );
return self.media.error;
}
});
if ( self.media.readyState >= 2 ) {
@ -346,6 +341,12 @@
return obj;
};
Popcorn.defineProperty = Object.defineProperty || function( object, description, options ) {
object.__defineGetter__( description, options.get || Popcorn.nop );
object.__defineSetter__( description, options.set || Popcorn.nop );
};
Popcorn.extend = function( obj ) {
var dest = obj, src = slice.call( arguments, 1 );