> Behaviors generally speaking are used only to decorate elements on the
> page. If you have a behavior that needs to refer to some global property
> (user data for example) I'd use the passMethod/passMethods argument to pass
> in getters for them to your filters. So your filter can do
> api.get('userdata') or whatever. Now you can easily search for and support
> that API.
> But putting behaviors on the document body doesn't really get you anything
> (unless you are really decorating the body). Instead, I'd instantiate these
> things and then pass them to behavior. Like so:
> var user = new User(...);
> var storage = new Storage(...);
> var b = new Behavior();
> b.passMethods({
> getUser: Function.from(user),
> getStorage: Function.from(storage)});
> b.apply(document.body);
> On Mon, Feb 27, 2012 at 2:36 PM, Rolf-nl <plentyofr...@gmail.com> wrote:
> > If you have some site-wide code/classes you want to use "globally",
> > (eg. LogSystem, CookieMonster, Storage, SuperFancyFX) are you adding
> > these to the dom in the first element after <body> for example, or
> > how?
> > That is what I have now, like using a wrapper div that's already
> > present for this behavior container <body><div id="wrapper" data-
> > behavior="Prefs Storage">...</div></body>
> > Then in other behaviors I use api.fireEvent('ThisBehaviorUpdated',
> > [foo, bar]) to broadcast and some behavior declared in this wrapper-
> > div can pick stuff up whenever it's needed.
> > Makes sense? Or wrooooong implementation?
> > Rolf
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Clientcide" group.
> > To post to this group, send email to clientside@googlegroups.com.
> > To unsubscribe from this group, send email to
> > clientside+unsubscribe@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/clientside?hl=en.