Skip to content
This repository was archived by the owner on Dec 4, 2023. It is now read-only.

Commit 57beb23

Browse files
committed
Add info on calling js functions to README
1 parent 9482e5b commit 57beb23

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ evaluate some simple JavaScript
3131
cxt = V8::Context.new
3232
cxt.eval('7 * 6') #=> 42
3333

34+
call JavaScript functions
35+
36+
cxt.eval "function isTruthy(arg) { return !!arg }"
37+
cxt.scope.isTruthy(0) #=> false
38+
3439
embed values into the scope of your context
3540

3641
cxt['foo'] = "bar"
@@ -173,4 +178,4 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
173178
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
174179

175180
[1]: https://github.com/cowboyd/libv8
176-
[2]: http://code.google.com/p/v8/wiki/BuildingWithGYP
181+
[2]: http://code.google.com/p/v8/wiki/BuildingWithGYP

0 commit comments

Comments
 (0)