macro_rules! js { ($($arg:ident),* =>> $($tt:tt)*) => { ... }; ($($tt:tt)*) => { ... }; }
Expand description
Allows a javascript function to be defined inline. Accepts 2 forms of syntax:
js!(<js code>);
js!(arg1, arg2, arg3 =>> <js code>)
There are some limitations:
===
and!==
cannot be parsed correctly, use==
and!=
instead.- String literals must be double-quoted, not single-quoted.
- Statements missing a terminating a semi-colon may not parse correctly.