mozilla-spidermonkey / spidermonkey-embedding-examples

Documentation and examples for embedding the SpiderMonkey JavaScript / WebAssembly engine in their applications.
Other
197 stars 34 forks source link

examples: Add 'hello' example #1

Closed ptomato closed 6 years ago

ptomato commented 6 years ago

This is a minimal example, illustrating how to execute some JavaScript code in a string which just prints 'hello world' and the current date. It's basically copied from the existing example on MDN: https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/How_to_embed_the_JavaScript_engine

ptomato commented 6 years ago

I've split it up into functions, made a few more modernizations, and turned off clang-format for the classops struct.