[Developers] acre.markup.define_browser_var

Stefano Mazzocchi stefano at metaweb.com
Mon Jul 27 19:07:17 UTC 2009


Philip Kendall wrote:
> I note acre.markup.define_browser_var is marked as deprecated. Is there
> an alternative way of obtaining this functionality, or is this a Bad
> Thing to be doing?

It's not a bad thing but it's redundant since Acre now will handle ${} 
expansion even inside <script> tags (because, luckily, ${} is an invalid 
syntax in javascript so we can distinguish it from $() which is valid 
and it's what, say, jQuery does).

So, if you want to pass an acre object over to the client side you can 
simply do

<acre:script>
  var a = whatever();
</acre:script>

<script>
  var a = ${JSON.stringify(a)};
</script>

-- 
Stefano Mazzocchi                              Application Catalyst
Metaweb Technologies, Inc.                      stefano at metaweb.com
-------------------------------------------------------------------



More information about the Developers mailing list