wimpy.onReady

 

This option is useful for knowing when wimpy has finished setting up.  There are a number of things that Wimpy does during setup such as:

- Load the Wimpy Player Icons (WimpyPlayerGlyphs font)
- Configure defaults
- Test browser capabilities
- Search for and set up Players
- Search for and set up Buttons
- Initialize Players
- Initialize Buttons

It is **probably safe** to say that by the time the global wimpy.onReady is triggered, all of the buttons and players will be ready as well. We say **probably** because there may be some situations where a player may not be fully set up because it is loading a "heavy" skin, or a very large playlist.

However, you can still make use of the global wimpy functions when wimpy is ready, which you can use in conjunction with other API methods.

wimpy.onReady(func, args...)

 

Parameters

func function

The function that will be "pinged" when wimpy is ready.

args mixed (optional)

Any number of arguments can be sent in. These arguments will be returned to your function.

 

 

Return Value

Any additional arguments you included.

 

See Also

 

Examples

Example 1
<!-- Establish a Player Instance via HTML
and assign an "id" to it -->
<div id="player1" data-wimpyplayer></div>

<script>
// Set up a function to get "pinged" when Wimpy is ready
function doSomething (){
var myPlayer = wimpy.getPlayer("player1");
myPlayer.setInfo("hello there!");
} // Queue the "doSomething" function wimpy.onReady(doSomething); </script>

 

Example 2 - this + binding + argument

<!-- Establish a Player Instance via HTML
and assign an "id" to it -->
<div id="player1" data-wimpyplayer></div>

<script>
// Set up a function to get "pinged" when Wimpy is ready
// Include the "myArgument" in the function argument zone.
var doSomething = function(myArgument){
var myPlayer = wimpy.getPlayer("player1");
myPlayer.setInfo(myArgument);
} // Queue the "doSomething" function this.wimpy.onReady(this.doSomething.bind(this), "Show this in player!"); </script>