This module's API allows to set weights for behaviors attached via Drupal.behaviors.
See How can I control the order of Drupal.behaviors? (on stackoverflow).

You will only need this module if you either want to use it in your own code, or if another module depends on it.

API Usage (D6)

  // Let this run before other behaviors (default weight is 0)
  Drupal.behaviors['mymodule_early.weight'] = -10;

  // Now define the behavior itself.
  Drupal.behaviors.mymodule_early = function(context){
    .. // your stuff to happen.

API Usage (D7)

  Drupal.behaviors.mymodule_early = {
    attach: function(context){..},
    weight: -11



  // D7-style weight setting, equivalent with the above. 
  Drupal.behaviors.mymodule_early.weight = -9;

  // D6-style weight setting, still supported in D7.
  // This has a lower priority than the D7-style setting. (don't ask why)
  Drupal.behaviors['mymodule_early.weight'] = -7;

  // The weight will be -7, because the ['..'] syntax has higher priority.

Looking for Co-Maintainer

This is never going to be a big module, but nevertheless it could be helpful to have someone else in the boat, if only as a critical voice!

Project Information