The jsb object

The jsb object is a base2 package. For convenience, the jsb object is global.

The jsb object provides access to the behavior, Rule and RuleList objects as well as to the createStyleSheet() method.

Constants

The following constants are defined on the jsb object:

INTERVAL: 25 (milliseconds)

The interval between refreshes of the rule engine.

TIMEOUT: 100 (milliseconds)

The maximum amount of time that any operation can take. The rule engine will timeout after this period and yield processing again.

QUERY_SIZE: 100 (elements)

The maximum number of elements to fetch in a DOM query. Setting this value too high means that behaviors may not be initialised evenly. Setting this value too low may increase rendering time. Oh the dilemma!

These are not real constants but they should be treated as such. You can try tweaking the values. Let me know the results. :)

Notes

All base2 packages have a namespace property that you can use to provide easy access to the properties of a package:

// use jsb's namespace
eval(jsb.namespace);

var mybehavior = behavior.extend({ // note that the "jsb." prefix is no longer required
  onclick: function(element) {
    // do something
  }
});