Skip to content

Commit

Permalink
Export bind on videojs. Fixes #2322
Browse files Browse the repository at this point in the history
closes #2332
  • Loading branch information
gkatsev authored and heff committed Jul 10, 2015
1 parent 5bcf3b4 commit 9de463e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))

--------------------

Expand Down
18 changes: 18 additions & 0 deletions src/js/video.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9de463e

Please sign in to comment.