Re:Mobl - A new open source language for mobile devices
by MatthewPhillips on Wednesday March 23, 2011 @08:13AM
(#2359008)
Mobl is control-based. From what I can tell, I can't do arbitrary (javascript) logic on the DOM unless it is wrapped in a control.
[ Parent
| on HN ]
Re:Mobl - A new open source language for mobile devices
by zefhemel on Wednesday March 23, 2011 @08:28AM
(#2359051)
right, well you can also do that from any piece of logic using the JQuery API, if you have to: http://docs.mobl-lang.org/mobl/JQuery
Re:Mobl - A new open source language for mobile devices
by MatthewPhillips on Wednesday March 23, 2011 @09:45AM
(#2359314)
That example has the logic being performed from an event callback. How can I perform logic when a control is created? For example, I want to insert some html div into the DOM, then instantiate some jquery plugin on the inserted div. I have tried this and the compiler complained. I'm sure I'm doing it wrong but the documentation doesn't help. For example
screen root() {
header("Title")
$("#div").someplugin();
}Can't do that. I tried to get around this by creating a control, but from what I can tell controls return html, not objects.
Re:Mobl - A new open source language for mobile devices
by Zef on Thursday March 24, 2011 @02:30AM
(#2363100)
Not sure this is the place for it (maybe ask on the google group?) But there's two ways:
screen root() { mydiv@<div/> script { mydiv.someplugin(); } }
mydiv will be bound to a JQuery object representing the div. You can also just do this:
screen root() { script { $("#div").someplugin(); } }
So generally your answer is: put it in a script { ... } block.