Rename the hook to "visible" and add documentation

This commit is contained in:
Amir E. Aharoni
2013-04-25 13:29:25 +03:00
parent b28bed9bb5
commit a568b3244e

View File

@@ -114,15 +114,26 @@
ULS.prototype = { ULS.prototype = {
constructor: ULS, constructor: ULS,
// A "hook" that runs after the ULS constructor.
// At this point it is not guaranteed that the ULS has its dimensions
// and that the languages lists are initialized.
//
// To use it, pass a function as the onReady parameter
// in the options when initializing ULS.
ready: function () { ready: function () {
if ( this.options.onReady ) { if ( this.options.onReady ) {
this.options.onReady.call( this ); this.options.onReady.call( this );
} }
}, },
afterShowing: function () { // A "hook" that runs after the ULS panel becomes visible
if ( this.options.afterShowing ) { // by using the show method.
this.options.afterShowing.call( this ); //
// To use it, pass a function as the onVisible parameter
// in the options when initializing ULS.
visible: function () {
if ( this.options.onVisible ) {
this.options.onVisible.call( this );
} }
}, },
@@ -166,17 +177,17 @@
this.initialized = true; this.initialized = true;
} }
// hide any other ULS visible // hide any other visible ULS
$( '.uls-menu' ).hide(); $( '.uls-menu' ).hide();
this.$menu.show(); this.$menu.show();
this.shown = true; this.shown = true;
this.afterShowing();
if ( !this.isMobile() ) { if ( !this.isMobile() ) {
this.$languageFilter.focus(); this.$languageFilter.focus();
} }
this.visible();
}, },
i18n: function () { i18n: function () {