Experimental project

This is a sandbox project, which contains experimental code for developer use only.

A very small module that extends the functionality of the object Drupal.behaviors. Allows other developers to define and invoke custom behaviors from very specific events that make their modules.

This function is like Drupal.attachBehaviors() but the developer can define
the name of the function to execute and when do it.


Drupal.behaviors.SomeModule = {
   attach: function(context, settings) {
     $('body', context).click(function() {
       // Here define the new function to execute on each object
       // Drupal.behaivors.
       Drupal.invokeBehaviors('bodyClicked', [variable1, variable2, context, settings]);

Another module:

Drupal.behaviors.AnotherModule = {
    attach: function(context, settings) {
      ... Do something or not.
    bodyClicked: function(variable1, variable2, context, settings) {
      ... Do something when the user click on the body element.

Project information