Facilitate exposing platform-exclusive interfaces to all platforms

This makes the interfaces available, without implementation, in other
platforms and the editor, which facilitates documenting platform-exclusive
classes.

Platform-exclusive APIs must be set up in platform/<platform>/api/api.cpp.
Provide noop method-implementations where necessary.

Also setup and document the HTML5 platform's JavaScript singleton.
This commit is contained in:
Leon Krause 2017-11-16 01:33:48 +01:00
parent 6b34f10ab1
commit 63b1a096eb
12 changed files with 211 additions and 35 deletions

View file

@ -29,16 +29,9 @@
/*************************************************************************/
#ifdef JAVASCRIPT_EVAL_ENABLED
#include "javascript_eval.h"
#include "api/javascript_eval.h"
#include "emscripten.h"
JavaScript *JavaScript::singleton = NULL;
JavaScript *JavaScript::get_singleton() {
return singleton;
}
extern "C" EMSCRIPTEN_KEEPALIVE uint8_t *resize_poolbytearray_and_open_write(PoolByteArray *p_arr, PoolByteArray::Write *r_write, int p_len) {
p_arr->resize(p_len);
@ -182,18 +175,4 @@ Variant JavaScript::eval(const String &p_code, bool p_use_global_exec_context) {
return Variant();
}
void JavaScript::_bind_methods() {
ClassDB::bind_method(D_METHOD("eval", "code", "use_global_execution_context"), &JavaScript::eval, false);
}
JavaScript::JavaScript() {
ERR_FAIL_COND(singleton != NULL);
singleton = this;
}
JavaScript::~JavaScript() {
}
#endif // JAVASCRIPT_EVAL_ENABLED