Is there a way to defer whole mason component in Mason 2
roland16 <[email protected]> Fri, 22 Feb 2013 17:23:06 +0100
| Newsgroups | gmane.comp.web.mason.user |
|---|---|
| Message-ID | <[email protected]> |
Hi,
Let's say there is a component title.mi which contains some information determined by child component of Base.mc.
'title.mi' component is called in <%augment wrap> method of Base.mc like:
<%class>
has 'title';
</%class>
<%augment wrap>
% $.Defer {{
<& 'title.mi' &>
% }}
<% inner() %>
</%augment>
title.mi :
<% $.title %>
The original 'title.mi' component is actually quite large and i don't want to put the code inside Base.mc.
Is there a way to set the 'title' attribute in child component of Base.mc (i.e. index.mc by writing $.title('deferred value') ) so that 'title.mi' will be executed with deferred value of 'title' attr?
As I understand, defer method gets a block of code and inserts it into the output at request end (executing this block by CODE->() and replacing the markups with executed code).
I know that calling component via <& &>, which is eq to $m->comp, executes the code that is inside.
$m->construct constructs and return a new instance of the component, but is there a way to call a main method of this component by the Defer plugin?
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb