Hi, Lift's abstractions on JS stuff are very useful as you can compose JS expressions very easily etc. However I would not recommend using JsExp/ JsCmd to generate large JS code because the Scala code would get quite big. But you can build you JS objects/function in your own JS file and from Ajax functions you build short expressions that calls your JS code etc.
Br's, Marius On Jan 8, 9:07 am, timshawn <[email protected]> wrote: > Hi there, > > I'm currently playing with Lift, and one of the things that surprised > me was how much Javascript code is in Scala for snippets and bind. > I'm not saying this is bad, because I haven't done an app this way > yet, but I'm more used to writing the JS myself using jQuery or some > other library. I can certainly understand that but sometime it is so convenient to write a small Scala code using Lift's JS abstractions and have the intended result. > I'm wondering if anyone has had more experience working with Lift and > maintaining an app in it, to say when in their opinion is a good time > to put things in JS or in Scala snippets, and the advantages and > disadvantages of putting most of the JS in snippets. (would you mostly > use it for Ajax callbacks and comet-related stuff, or would you do a > lot more stuff like hide/unhiding elements, etc. in scala?) Actually both I'd say (depending on the situations) as long as the Scala code for generating JsExp/JsCmd is reasonably small. > > The one thing I can think of is Scala's type safety, but when for > example, I accidentally change an HTML node's id and there is a JSCmd > to trigger behaviour on that, there won't be JS errors, but the > "right"/expected behaviour won't happen either. Well accidents are accidents and IMO this is an application specific concern and not a framework concern. I mean regardless if the JS code come from JsCmd/JsExp or plain Javascript from .js files consistency between markup and JS code should be ensured to have expected behaviors. > > Thanks, > Tim --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Lift" group. 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/liftweb?hl=en -~----------~----~----~----~------~----~------~--~---
