[Debugger] JS API: Add PJ64_JSAPI_VERSION constant (#2119)
This commit is contained in:
parent
d72242d081
commit
1606b23ef9
|
@ -1,8 +1,8 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- Generated Sep 02 2021 -->
|
||||
<!-- Generated Sep 28 2021 -->
|
||||
<!-- YAML source: https://github.com/shygoo/pj64d-docs -->
|
||||
<head>
|
||||
<title>Project64 JavaScript API 2021.09.02</title>
|
||||
<title>Project64 JavaScript API 2021.09.28</title>
|
||||
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,400italic,700,700italic' rel='stylesheet' type='text/css'>
|
||||
<style>
|
||||
:root {
|
||||
|
@ -279,7 +279,7 @@ window.addEventListener('load', function() {
|
|||
<div class="sidebar">
|
||||
<div class="sidebar-content">
|
||||
<div class="pagetitle">Project64 JavaScript API</div>
|
||||
2021.09.02
|
||||
2021.09.28
|
||||
<hr>
|
||||
<ul>
|
||||
<p><li><a class="" href="#Project64 JavaScript API">Project64 JavaScript API</a><ul>
|
||||
|
@ -440,6 +440,7 @@ window.addEventListener('load', function() {
|
|||
</ul></li></p>
|
||||
<p><li><a class="" href="#Globals">Globals</a><ul>
|
||||
<li><a class="" href="#global">global</a></li>
|
||||
<li><a class="" href="#PJ64_JSAPI_VERSION">PJ64_JSAPI_VERSION</a></li>
|
||||
<li><a class="" href="#require">require(id)</a></li>
|
||||
<li><a class="" href="#exec">exec(command[, options])</a></li>
|
||||
<li><a class="" href="#alert">alert(message[, caption])</a></li>
|
||||
|
@ -1784,6 +1785,24 @@ Reference to the global object.
|
|||
<span class="js-word">global</span>.<span class="js-word">test</span> = <span class="js-number">1</span>;
|
||||
<span class="js-word">console</span>.<span class="js-word">log</span>(<span class="js-word">test</span>); <span class="js-comment">// "1"</span>
|
||||
</pre>
|
||||
<!-- PJ64_JSAPI_VERSION -->
|
||||
<p><div class="prop"><span class="title" id="PJ64_JSAPI_VERSION">PJ64_JSAPI_VERSION</span></div>
|
||||
<div class="tsproto">PJ64_JSAPI_VERSION: string</div>
|
||||
</p>
|
||||
<p>API major version name.</p>
|
||||
<table>
|
||||
<tr><td><span class="snip">"jsapi-2"</span></td><td>Second edition (Project64 4.0+)</td></tr>
|
||||
<tr><td><span class="snip">undefined</span></td><td><a target="blank" href="https://htmlpreview.github.io/?https://github.com/project64/project64/blob/5d0d9927b1fd91e9647eb799f68e132804de924e/apidoc.htm">First edition</a> (Project64 2.4 to 3.x)</td></tr>
|
||||
</table>
|
||||
<pre class="ex">
|
||||
<span class="js-keyword">if</span> (<span class="js-keyword">typeof</span> <span class="js-word">PJ64_JSAPI_VERSION</span> !== <span class="js-string">'undefined'</span>) {
|
||||
<span class="js-comment">// use new API</span>
|
||||
}
|
||||
<span class="js-keyword">else</span> {
|
||||
<span class="js-comment">// use old API</span>
|
||||
}
|
||||
</pre>
|
||||
See also: <a target="blank" href="https://htmlpreview.github.io/?https://github.com/project64/project64/blob/5d0d9927b1fd91e9647eb799f68e132804de924e/apidoc.htm">First edition documentation</a>
|
||||
<!-- require -->
|
||||
<p><div class="prop"><span class="title" id="require">require(id)</span></div>
|
||||
<div class="tsproto">require(id: string): Object</div>
|
||||
|
|
|
@ -13,6 +13,12 @@ void ScriptAPI::InitEnvironment(duk_context* ctx, CScriptInstance* inst)
|
|||
duk_def_prop(ctx, -3, DUK_DEFPROP_HAVE_VALUE | DUK_DEFPROP_SET_ENUMERABLE);
|
||||
duk_pop(ctx);
|
||||
|
||||
duk_push_global_object(ctx);
|
||||
duk_push_string(ctx, "PJ64_JSAPI_VERSION");
|
||||
duk_push_string(ctx, PJ64_JSAPI_VERSION);
|
||||
duk_def_prop(ctx, -3, DUK_DEFPROP_HAVE_VALUE | DUK_DEFPROP_SET_ENUMERABLE);
|
||||
duk_pop(ctx);
|
||||
|
||||
duk_module_duktape_init(ctx);
|
||||
duk_get_global_string(ctx, "Duktape");
|
||||
duk_push_c_function(ctx, js_Duktape_modSearch, 4);
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#define PJ64_JSAPI_VERSION "jsapi-2"
|
||||
|
||||
#define HS_gAppCallbacks DUK_HIDDEN_SYMBOL("gAppCallbacks")
|
||||
#define HS_gInstancePtr DUK_HIDDEN_SYMBOL("gInstancePtr")
|
||||
#define HS_gInputListener DUK_HIDDEN_SYMBOL("gInputListener")
|
||||
|
|
Loading…
Reference in New Issue