The app isn't in production yet, so I don't know how users will react, but hopefully they will appreciate being made aware of that things are happening.
To load the object, put this in a JavaScript library (client side)
dojo.addOnLoad(function(){ new StandbyWidget(); });
The default background color is bright yellow. To override, simply put a hex string in the "constructor" call.dojo.addOnLoad(function(){ new StandbyWidget( '#555'); }); // Dark grey
To use the code snippet below, you also need the partial event hijackervar StandbyWidget = function( backgroundColor ){
dojo.require( 'dojox.widget.Standby' );
this.widget = new dojox.widget.Standby();
this.widget.attr( 'color', backgroundColor || '#ffe' );
document.body.appendChild( this.widget.domNode );
this.widget.startup();
dojo.subscribe( 'partialrefresh-init', this, function( method, form, targetId ){
if( targetId && targetId !== '@none' ){ this.show( targetId ); }
});
dojo.subscribe( 'partialrefresh-complete', this, function( method, form, targetId ){
if( targetId && targetId !== '@none' ){ this.hide(); }
});
dojo.subscribe( 'partialrefresh-error', this, function( method, form, targetId ){
if( targetId && targetId !== '@none' ){ this.hide(); }
});
}
StandbyWidget.prototype = {
show: function( targetId ){
this.widget.attr( 'target', targetId );
this.widget.show();
},
hide: function(){
this.widget.hide();
}
}
0 comments:
Post a Comment