spinner.js

Summary
spinner.js
bbop.widget.spinnerBBOP object to produce a self-constructing/self-destructing spinner.
Functions
spinnerContructor for the bbop.widget.spinner object.
showShow the spinner if it is hidden (regardless of current waits).
hideHide the spinner if it is showing (regardless of current waits).
start_waitDisplays the initial spinner if it is not already displayed and adds one to the wait count.
finish_waitRemoves one from the wait count and hides the spinner if the number of outstanding waits has reached zero.
clear_waitsHides the spinner and resets all the waiting counters.

bbop.widget.spinner

BBOP object to produce a self-constructing/self-destructing spinner.  It can display various spinner/throbber images and can have a set timeout to deal with annoying servers and exotic race conditions.

The class of the spinner image is “bbop-widget-spinner”.

Visibility is controlled by the application and removal of “bbop-js-spinner-hidden”.

This is a completely self-contained UI.

Summary
Functions
spinnerContructor for the bbop.widget.spinner object.
showShow the spinner if it is hidden (regardless of current waits).
hideHide the spinner if it is showing (regardless of current waits).
start_waitDisplays the initial spinner if it is not already displayed and adds one to the wait count.
finish_waitRemoves one from the wait count and hides the spinner if the number of outstanding waits has reached zero.
clear_waitsHides the spinner and resets all the waiting counters.

Functions

spinner

bbop.widget.spinner = function(host_elt_id,
img_src,
argument_hash)

Contructor for the bbop.widget.spinner object.

A trivial invocation might be something like

var s = new bbop.widget.spinner("inf01", "http://localhost/amigo2/images/waiting_ajax.gif");
s.hide();
s.show();

Or, in a slightly different use case

var s = new bbop.widget.spinner("inf01", "http://localhost/amigo2/images/waiting_ajax.gif", {'timout': 5});
s.start_wait();

The optional hash arguments look like

timeoutthe number of seconds to wait before invoking clear_waits; 0 indicates waiting forever; defaults to 5
visible_pwhether or not the spinner is visible on initialization; true|false; defaults to true
classesa string of space-separated classes that you want added to the spinner image

Arguments

host_elt_idstring id of the place to place the widget
img_srcthe URL for the image to use in the spinner
argument_hash[optional] optional hash of optional arguments

Returns

self

show

this.show = function()

Show the spinner if it is hidden (regardless of current waits).

Parameters

n/a

Returns n/a

hide

this.hide = function()

Hide the spinner if it is showing (regardless of current waits).

Parameters

n/a

Returns n/a

start_wait

this.start_wait = function()

Displays the initial spinner if it is not already displayed and adds one to the wait count.

Parameters

n/a

Returns n/a

finish_wait

this.finish_wait = function()

Removes one from the wait count and hides the spinner if the number of outstanding waits has reached zero.

Parameters

n/a

Returns n/a

clear_waits

this.clear_waits = function()

Hides the spinner and resets all the waiting counters.  Can be used during things like server errors or collisions.

Parameters

n/a

Returns n/a

bbop.widget.spinner = function(host_elt_id,
img_src,
argument_hash)
Contructor for the bbop.widget.spinner object.
this.show = function()
Show the spinner if it is hidden (regardless of current waits).
this.hide = function()
Hide the spinner if it is showing (regardless of current waits).
this.start_wait = function()
Displays the initial spinner if it is not already displayed and adds one to the wait count.
this.finish_wait = function()
Removes one from the wait count and hides the spinner if the number of outstanding waits has reached zero.
this.clear_waits = function()
Hides the spinner and resets all the waiting counters.
Close