Last active
April 11, 2016 22:35
-
-
Save jtwalters/64abc2c71a0eb421250a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* New Tabia/Components JS-pattern. | |
*/ | |
// Loose augmentation pattern. Creates top-level namespace variable if it | |
// doesn't already exist. | |
var Tabia = Tabia || {}; | |
// Create a base for this module's data and functions. | |
Tabia.myBehavior = {}; | |
// Closure to extend behavior, provide privacy and state. | |
(function (behavior, $) { | |
/** | |
* Private variables | |
*/ | |
var foo, | |
bar; | |
/** | |
* Public variables | |
*/ | |
behavior.options = { | |
foo: 'bar' | |
}; | |
/** | |
* DOM-ready callback. | |
* - DOM element context: this.context | |
* - Drupal settings object: this.settings | |
*/ | |
behavior.ready = function ($) { | |
// Initialize behavior here. | |
}; | |
})(Tabia.myBehavior, jQuery); | |
// Initialize Drupal behavior. | |
Drupal.behave('myBehavior').ready(Tabia.myBehavior.ready); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment