开发者

Using Javascript HTML5 typed arrays from Java using the ScriptManager (Rhino), how?

开发者 https://www.devze.com 2023-03-23 20:47 出处:网络
I\'ve been porting and application I developed in client Javascript to my server (for a multiplayer game purposes). I am executing some parts using the ScriptEngine because I want to use the same code

I've been porting and application I developed in client Javascript to my server (for a multiplayer game purposes). I am executing some parts using the ScriptEngine because I want to use the same code in the client and the server without having to recode everything twice.

At the beginning it worked fine but then I stumbled uppon the problem of the new typed arrays from HTML5 (Float32Array, Uint8Array...). These arrays are not supported by Sc开发者_StackOverflow中文版riptEngine (Rhino), and I need them for performance reasons so I cant reimplement them in javascript using non-typed arrays.

I thought to reimplement them using Java and importing the package, but there is no way to reimplement [] operators in Java nor extend the basic arrays (AFAIK).

So at the end Im doing a hack and putting some rules for the developer.

Does anyone knows a solution or a way to reimplement the typed arrays in Java and export them to Javascript?.

Thanks


If i am not mistaken, This might help you

http://json.org/java/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号