diff --git a/examples/js-binding.rkt b/examples/js-binding.rkt new file mode 100644 index 0000000..0a148d1 --- /dev/null +++ b/examples/js-binding.rkt @@ -0,0 +1,11 @@ +#lang planet dyoo/whalesong +(require (planet dyoo/whalesong/js)) + +(define js-plus + (js-function (js-eval "function(x, y) { return x + y; }"))) + +(define js-minus + (js-function (js-eval "function(x, y) { return x - y; }"))) + +"plus: " (js-plus 3 4) +"minus:" (js-minus 239748 23) \ No newline at end of file diff --git a/js/racket-impl.rkt b/js/racket-impl.rkt index e12a3ac..6f6c418 100644 --- a/js/racket-impl.rkt +++ b/js/racket-impl.rkt @@ -21,6 +21,9 @@ js-eval load-script + + js-function + js-async-function ) (define (alert x)