• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1{
2  "Aki sync function": {
3    "prefix": "akisyncfunc",
4    "body": [
5      "std::string SayHello(std::string msg) { return msg + \" too.\"; }",
6      "// Register the AKI plugin name: It is the name of the compiled *.so file, following the same rules as NAPI.",
7      "JSBIND_ADDON(entry)",
8      "// Used to define the scope of global functions that need to be bound.",
9      "JSBIND_GLOBAL() {",
10      "    // 'SayHello' function can be directly called from JavaScript.",
11      "    JSBIND_FUNCTION(SayHello);",
12      "}"
13    ]
14  },
15  "Aki async function": {
16    "prefix": "akiasyncfunc",
17    "body": [
18      "std::string AsyncSayHello(std::string msg) {",
19      "  // Do something;",
20      "  return msg + \" too.\";",
21      "}",
22      "// Register the AKI plugin name: It is the name of the compiled *.so file, following the same rules as NAPI.",
23      "JSBIND_ADDON(entry)",
24      "// Used to define the scope of global functions that need to be bound.",
25      "JSBIND_GLOBAL() {",
26      "    // function can be called asynchronously from JavaScript with Promises.",
27      "    JSBIND_PFUNCTION(AsyncSayHello);",
28      "}"
29    ]
30  }
31}