It seems that vjs is a sort of Util namespace that contains a few functions that should be used in different places. As long as that is public it can be used anywhere:
vjs = {};
vjs.parseHex = function(c) { /*...*/ }
vjs.parseRed = function(c) { /*...*/ }
js.VolumeBar.prototype.drawSound = function(){
vjs.parseRed(stuff);
}
Keep in mind that if you pass vjs.parseRed
as a callback, it will be called with a different object as this
than what you expect. You could rewrite it to either
replace
this
withvjs
:vjs.parseRed = function(c) { return parseInt((vjs.parseHex(c)).substring(0,2),16); }
bind the functions when you pass them as parameters:
doAsync(vjs.parseRed.bind(vjs));
or just bind them when you define them:
vjs.parseRed = function(c) { /*...*/ }.bind(vjs);