diff options
Diffstat (limited to 'platform/javascript/api')
-rw-r--r-- | platform/javascript/api/api.cpp | 10 | ||||
-rw-r--r-- | platform/javascript/api/api.h | 5 |
2 files changed, 7 insertions, 8 deletions
diff --git a/platform/javascript/api/api.cpp b/platform/javascript/api/api.cpp index 88de13d771..9c73e5c4c4 100644 --- a/platform/javascript/api/api.cpp +++ b/platform/javascript/api/api.cpp @@ -35,40 +35,34 @@ static JavaScript *javascript_eval; void register_javascript_api() { - ClassDB::register_virtual_class<JavaScript>(); javascript_eval = memnew(JavaScript); Engine::get_singleton()->add_singleton(Engine::Singleton("JavaScript", javascript_eval)); } void unregister_javascript_api() { - memdelete(javascript_eval); } -JavaScript *JavaScript::singleton = NULL; +JavaScript *JavaScript::singleton = nullptr; JavaScript *JavaScript::get_singleton() { - return singleton; } JavaScript::JavaScript() { - - ERR_FAIL_COND_MSG(singleton != NULL, "JavaScript singleton already exist."); + ERR_FAIL_COND_MSG(singleton != nullptr, "JavaScript singleton already exist."); singleton = this; } JavaScript::~JavaScript() {} void JavaScript::_bind_methods() { - ClassDB::bind_method(D_METHOD("eval", "code", "use_global_execution_context"), &JavaScript::eval, DEFVAL(false)); } #if !defined(JAVASCRIPT_ENABLED) || !defined(JAVASCRIPT_EVAL_ENABLED) Variant JavaScript::eval(const String &p_code, bool p_use_global_exec_context) { - return Variant(); } #endif diff --git a/platform/javascript/api/api.h b/platform/javascript/api/api.h index 164d679205..8afe0f33ce 100644 --- a/platform/javascript/api/api.h +++ b/platform/javascript/api/api.h @@ -28,5 +28,10 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ +#ifndef JAVASCRIPT_API_H +#define JAVASCRIPT_API_H + void register_javascript_api(); void unregister_javascript_api(); + +#endif // JAVASCRIPT_API_H |