Module Framework
Monkey Forums/Monkey Programming/Module Framework
| ||
Would someone be kind enough to post an example of how a module is created. What are the steps, how to include native target code in the module and how to include the module in a monkey project and call one of it's methods. Thanks. |
| ||
I just guess it's like mojo et al. is done. So you just have your main include (import) which imports all other files. You might have to add native code for the targets if you do something special. I assume it's only possible to distribute the monkey code but not some kind of precompiled stuff (like intermediate code)? |
| ||
Is there a module specification document? |
| ||
A file is a module, you don't have to do anything. Anything put in the module folder will have direct import access. import mojo.graphics where mojo is a folder in the /module/ folder |
| ||
That's not quite what I mean.. I want to have a method called getAsyncStream(url, data, callback) - this method should reference an External file, which file depends on the compiler target. So I compile to HTML5 and the Method will access the corresponding method in mymodule.HTML5.js etc... etc.. |
| ||
Looking at mojo, it looks like you need to create a folder called "native" inside your module folder with a file named:<module>.<platform>.<ext> i.e. mojo.android.java Then you define platform specific functionality in there and in the monkey files, you define monkey equivalents I'm probably overly simplifying it due to lack of practical knowledge :) |
| ||
OK - I've worked it out. Thanks to everyone for hints etc.. |