Closed jan--f closed 10 years ago
Note that you can also wrap the space in single quotes:
js:call(JS, <<"function(x) {return x.split(' ')}">>, [<<"foo bar">>]).
The problem seems to be the quotes in the "function name" when used as a string in the argument to throw()
in js.erl.
I haven't done any thorough testing, but doing something like:
EscapedFunctionName = binary:replace(FunctionName, <<"\"">>, <<"\\\"">>, [global])
And then:
[...] throw(\">>, EscapedfunctionName, <<" not [...]
Seems to work.
Hi, I was playing aroung with erlang_js and encountered the following behavior: I want to run the following js function with a string as the argument:
there are three ways I can think of doing this and two work, whereas the third does not.
and
both return the expected
{ok, [<<"foo">>, <<"bar">>]}
when I try to do call an anonymous function I get an error:
something is going wrong with the space character in split(). If I pass it in as an argument it works fine again: