Spigot SpigotJS 1.0

Spigot + Nashorn

  1. smrkn submitted a new resource:

    SpigotJS - Spigot + Nashorn

    Read more about this resource...
  2. WAS


    While I believe JavaScript is being horrifically abused by people; for instances NodeJS, I still think this sort of stuff is really cool being seen done. Just goes to show, ya know.

    I'm wondering what the advantages of this are, if any? And what disadvantages there may be?
  3. Well, one thing that makes it quite nifty is that JavaScript syntax is far more relaxed than Java's. If someone took the time to construct a framework centered around Nashorn then plugin development as a whole becomes far less intimidating for less experienced people who wish to pursue it, and at the same time you end up with less time being spent on development when you go full JavaScript mode.

    Disadvantages could be that it could be hard to trace errors without some poking around.
  4. WAS


    What about performance and the fact JS has none? For example how is the FQN system working? Are these prototype objects or coming from vars? Both have inherent performance issues, especially in contrast to Java. JavaScript also has poor event handling.
  5. In the case of the usage of FQNs in the spigot-js plugin, vars, I simply provide an events object which uses the value of Class#getSimpleName mapped to the value of Class#getCanonicalName for user convenience. Nashorn does also provides some helper functions that also re-use FQNs, though in most cases these will only be functions that interact with java code.

    Event handling for spigot-js is done in java code via the emit method of the ScriptInterface class, only simple iteration of a set of event consumers.

    I'll have to write up some test cases just to see what performance is actually like once I've fleshed the project out a bit more.
    • Like Like x 1