On 1 October 2012 00:46, Owen Winkler <[email protected]> wrote:
>
> Habari itself would register a named StackItem for each vendor script that
> it provides.  Instead of providing the full URL of a script (CSS would work
> similarly) to Stack::add(), you would use StackItem::get() to return a
> registered StackItem object with a specific name (and possibly version) to
> be added to the Stack.  For example:
>
> Stack::add( 'test_stack', StackItem::get('jquery') );
>
> A StackItem will already have been assigned a name and dependencies when it
> is registered, so there is no need to include those in the call to
> Stack::add().  Current code that passes a string or array as an item to
> Stack::add() as the $value parameter will simply be registered as a new
> StackItem at that time, and added to the stack.

If I understand you correctly, existing StackItems would be checked
before adding a new StackItem, so duplicates wouldn't be possible.

Thus an end user would never have to use StackItem, right? The above
code could just be:

Stack::add( 'test_stack', 'jquery' );

> New functionality could also allow lambdas to be passed as the $value
> parameter in Stack::add() or the $resource parameter to
> StackItem::register().  These lambdas would be called when the stack is
> built, and their return values would be used in the stack.  This would make
> it possible to define StackItems that have conditions, so that you would
> always add them to the stack using the simple Stack::add() call above, but
> they would only appear in output or contain different output based on
> internal criteria checked at runtime.

Cool :)

-- 
Michael C. Harris
http://twofishcreative.com/michael/blog
IRC: michaeltwofish #habari

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at http://groups.google.com/group/habari-dev

Reply via email to