Skip to content

Latest commit

 

History

History
34 lines (29 loc) · 860 Bytes

File metadata and controls

34 lines (29 loc) · 860 Bytes
# FCT_Node Examples

## Basic Interoperation
```c++
// C++ function callable from JavaScript
env.global()["cppAdd"] = [](int a, int b) { return a + b; };

// Call JavaScript from C++
auto result = env.callFunction<std::string>("jsFunction");

Object Manipulation

JSObject user = env.callFunction<JSObject>("createUser", "Alice", 25);
string name = user["name"];  // Access properties
user["age"] = 26;           // Modify properties

Asynchronous Operations

auto promise = env.callFunction<JSPromise>("asyncOperation");
while (!promise.isSettled()) {
    env.tick();
    std::this_thread::sleep_for(10ms);
}

Complete Example

See tutorial repository for complete examples including:

  • AI service integration
  • Web API consumption
  • Complex object serialization