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

@dconnolly exported the missing videojs.plugin function. closes #2103

This commit is contained in:
Deirdre Connolly 2015-04-30 14:49:22 -07:00 committed by heff
parent cc6c3daaed
commit f84632e057
3 changed files with 27 additions and 0 deletions

View File

@ -21,6 +21,7 @@ CHANGELOG
* @bc-bbay Load plugins before controls ([view](https://github.com/videojs/video.js/pull/2094))
* @bc-bbay rename onEvent methods to handleEvent ([view](https://github.com/videojs/video.js/pull/2093))
* @dmlap added an error message if techOrder is not in options ([view](https://github.com/videojs/video.js/pull/2097))
* @dconnolly exported the missing videojs.plugin function ([view](https://github.com/videojs/video.js/pull/2103))
--------------------

View File

@ -17,6 +17,7 @@ import * as Lib from './lib';
import * as Util from './util.js';
import Player from './player';
import extendsFn from './extends.js';
import plugin from './plugins.js';
if (typeof HTMLVideoElement === 'undefined') {
document.createElement('video');
@ -41,6 +42,8 @@ videojs.players = Player.players;
videojs.extends = extendsFn;
videojs.plugin = plugin;
// REMOVING: We probably should not include this in 5.0 thought it would make it
// more backwards compatible
// // Expose but deprecate the window[componentName] method for accessing components

23
test/unit/video.js Normal file
View File

@ -0,0 +1,23 @@
import videojs from '../../src/js/video.js';
import TestHelpers from './test-helpers.js';
q.module('video.js');
test('should expose plugin registry function', function() {
var pluginName, pluginFunction, player;
pluginName = 'foo';
pluginFunction = function(options) {
console.log(this);
};
ok(videojs.plugin, 'should exist');
videojs.plugin(pluginName, pluginFunction);
player = TestHelpers.makePlayer();
ok(player.foo, 'should exist');
equal(player.foo, pluginFunction, 'should be equal');
});