Skip to content
Beecher edited this page Sep 29, 2015 · 1 revision

Callbacks / Events / Init

  • There's a pile of callbacks that can be defined when you init the _mb.
  • All callbacks are optional.
  • Most callbacks are passed :
    • a reference to the modal object, and some local vars for the main bits of markup.
    • i.e. _mb, $wrap, $header, $body, $footer, $close
var args = {
	callbacks: {
		beforeInit : function() {
			console.log('beforeInit');
		},
		onInit :  function(_mb, $wrap, $header, $body, $footer, $close) {
			console.log('onInit');
			console.log(_mb);
			console.log($wrap);
		},
		beforeMarkup : function() {
			console.log('beforeMarkup');
		},
		onMarkup :  function() {
			console.log('onMarkup');
		},
		beforeBind : function() {
			console.log('beforeBind');
		},
		onBind :  function() {
			console.log('onBind');
		},
		beforeShow : function() {
			console.log('beforeShow');
		},
		onShow :  function() {
			console.log('onShow');
		},
		beforeHide :  function() {
			console.log('beforeHide');
		},
		onHide :  function() {
			console.log('onHide');
		},
		yarp : function() {
			// this needs to be defined in the show(args)
			console.log('yarp fires when the confirm button has been hit');
		},
		narp : function() {
			// this needs to be defined in the show(args)
			console.log('narp fires when the cancel button has been hit');
		}
	}
};

_mb.init(args);

Clone this wiki locally