1
0
mirror of https://github.com/videojs/video.js.git synced 2024-11-24 08:42:25 +02:00

Export bind on videojs. Fixes #2322

closes #2332
This commit is contained in:
Gary Katsevman 2015-07-09 16:32:45 -04:00 committed by heff
parent 5bcf3b40e3
commit 9de463e35c
2 changed files with 19 additions and 0 deletions

View File

@ -62,6 +62,7 @@ CHANGELOG
* @dmlap fixed a vjs_getProperty error caused by a progress check before the swf was ready ([view](https://github.com/videojs/video.js/pull/2316))
* @dmlap exported the videojs.log function ([view](https://github.com/videojs/video.js/pull/2317))
* @gkatsev updated vttjs to fix a trailing comma JSON error ([view](https://github.com/videojs/video.js/pull/2331))
* @gkatsev exported the videojs.bind() function ([view](https://github.com/videojs/video.js/pull/2332))
--------------------

View File

@ -8,6 +8,7 @@ import globalOptions from './global-options.js';
import Player from './player';
import plugin from './plugins.js';
import mergeOptions from '../../src/js/utils/merge-options.js';
import * as Fn from './utils/fn.js';
import assign from 'object.assign';
import log from './utils/log.js';
@ -257,6 +258,23 @@ videojs.extends = extendsFn;
*/
videojs.mergeOptions = mergeOptions;
/**
* Change the context (this) of a function
*
* videojs.bind(newContext, function(){
* this === newContext
* });
*
* NOTE: as of v5.0 we require an ES5 shim, so you should use the native
* `function(){}.bind(newContext);` instead of this.
*
* @param {*} context The object to bind as scope
* @param {Function} fn The function to be bound to a scope
* @param {Number=} uid An optional unique ID for the function to be set
* @return {Function}
*/
videojs.bind = Fn.bind;
/**
* Create a Video.js player plugin
* Plugins are only initialized when options for the plugin are included