How do I pass a Long[] array or List<Long> to a JSNI function like this:
public native void updateData(Long[] data)/*-{
waveform.update({
data: [0.5, 1.0, 0.5, 1.0]
});
}-*/;
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can’t, for various reasons.
JsArray(orJsArrayNumberor etc.). Same for ajava.util.List.java.lang.Longwould be an opaque object to JSNIlongit wouldn’t work, because you cannot pass alongto JSNI. This is because not all longs can be represented as JS numbers. The equivalent of a JSNumberisdouble.You have to copy your
Long[]into aJsArrayNumber, and cope for the possible overflows when down-casting thelongvalue into adoublevalue.