[rkward-devel] JS in rkwarddev
meik michalke
meik.michalke at uni-duesseldorf.de
Mon Oct 26 21:45:15 UTC 2015
Am Samstag, 24. Oktober 2015, 21:05:08 schrieb Thomas Friedrichsmeier:
> > that is, operators like !=, ==, > etc. are prevented from evaluation
> > by jo() and pasted as-is to the JS code.
>
> Neat hack! But not a path I'd like to go, personally. To be honest,
> those ite()-statements just give me the shivers, in the first place.
> It's simply a pradigm that helps spreading the logic between (literal)
> JS and R (from which JS is to be generated), and I just fail to see the
> actual benefit. (Ok, I would see the point, if you could actually move
> _all_ logic from literal JS to R, but that does not seem to work out).
i've just replaced the jo() function with the more powerful js() function:
it is now possible to use plain if() conditions (nested as deep as you
wish...) in rkwarddev to re-generate equivalent JavaScript conditions:
old way (still works):
ite(id(x, " != \"\""),
echo(", select=c(", x, ")"),
echo("")
)
new way:
js(
if(x != "") {
echo(", select=c(", x, ")")
} else {
echo("")
}
)
both will lead to a JS printout of this:
if(x != "") {
echo(", select=c(" + x + ")");
} else {
echo("");
}
this can most likely be done for other conditional statements as well. but as
of now everything after the first call is being discarded, i yet need to add a
while loop to check for more... however, i consider this kind of a
breakthrough ;-)
viele grüße :: m.eik
--
dipl. psych. meik michalke
institut f"ur experimentelle psychologie
abt. f"ur diagnostik und differentielle psychologie
heinrich-heine-universit"at d-40204 d"usseldorf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/rkward-devel/attachments/20151026/727be96a/attachment.sig>
More information about the rkward-devel
mailing list