summaryrefslogtreecommitdiff
path: root/Base/home
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-03-12 19:53:31 +0100
committerAndreas Kling <kling@serenityos.org>2020-03-12 19:54:47 +0100
commit7912f33ea0c223b88ff79ad4c072ec87dd0c29c4 (patch)
treec5c1b67c6dcf6605b02d2eb4a5f52be4fc956499 /Base/home
parentcc8e3048bc7d807154765297d4bf381f368bf3ed (diff)
downloadserenity-7912f33ea0c223b88ff79ad4c072ec87dd0c29c4.zip
LibJS: Add NativeFunction, a callable wrapper around a C++ lambda
This can be used to implement arbitrary functionality, callable from JavaScript. To make this work, I had to change the way CallExpression passes arguments to the callee. Instead of a HashMap<String, Value>, we now pass an ordered list of Argument { String name; Value value; }. This patch includes a native "print(argument)" function. :^)
Diffstat (limited to 'Base/home')
-rw-r--r--Base/home/anon/js/native-function.js1
1 files changed, 1 insertions, 0 deletions
diff --git a/Base/home/anon/js/native-function.js b/Base/home/anon/js/native-function.js
new file mode 100644
index 0000000000..932eb9cf56
--- /dev/null
+++ b/Base/home/anon/js/native-function.js
@@ -0,0 +1 @@
+print("Hello friends!")