Copyright © 2009-2010 Basho Technologies Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Authors: Kevin Smith (ksmith@basho.com).
init_fun() = function(port())
define_js/2 | Define a Javascript expression: js_driver:define(Port, <<"var x = 100;">>). |
define_js/4 | Define a Javascript expression: js_driver:define(Port, <<var blah = new Wubba();">>). |
destroy/1 | Destroys a Javascript VM instance. |
eval_js/2 | Evaluate a Javascript expression and return the result. |
load_driver/0 | Attempt to load the Javascript driver. |
new/0 | Create a new Javascript VM instance and preload Douglas Crockford's json2 converter (http://www.json.org/js.html). |
new/2 | Create a new Javascript VM instance and preload Douglas Crockford's json2 converter (http://www.json.org/js.html). |
new/3 | Create a new Javascript VM instance. |
shutdown/1 | Destroys a Javascript VM instance and shuts down the underlying Javascript infrastructure. |
define_js(Ctx::port(), Js::binary()) -> ok | {error, any()}
Define a Javascript expression: js_driver:define(Port, <<"var x = 100;">>).
define_js(Ctx::port(), FileName::binary(), Js::binary(), Timeout::integer()) -> {ok, binary()} | {error, any()}
Define a Javascript expression: js_driver:define(Port, <<var blah = new Wubba();">>). Note: Filename is used only as a label for error reporting.
destroy(Ctx::port()) -> ok
Destroys a Javascript VM instance
eval_js(Ctx::port(), Js::binary()) -> {ok, any()} | {error, any()}
Evaluate a Javascript expression and return the result
load_driver() -> true | false
Attempt to load the Javascript driver
new() -> {ok, port()} | {error, atom()} | {error, any()}
Create a new Javascript VM instance and preload Douglas Crockford's json2 converter (http://www.json.org/js.html). Uses a default heap size of 8MB and a default thread stack size of 8KB.
Create a new Javascript VM instance and preload Douglas Crockford's json2 converter (http://www.json.org/js.html)
new(ThreadStackSize::int(), HeapSize::int(), Initializer::no_json | init_fun() | {ModName::atom(), FunName::atom()}) -> {ok, port()} | {error, atom()} | {error, any()}
Create a new Javascript VM instance. The function arguments control how the VM instance is initialized. User supplied initializers must return true or false.
shutdown(Ctx::port()) -> ok
Destroys a Javascript VM instance and shuts down the underlying Javascript infrastructure. NOTE: No new VMs can be created after this call is made!
Generated by EDoc, Mar 24 2025, 11:53:57.