cleanup, docs
This commit is contained in:
@@ -37,38 +37,12 @@ For `RENDER...` and `COMPONENT...`, the unit's `ONCE(Request& context)` hook is
|
||||
|
||||
Example:
|
||||
|
||||
```cpp
|
||||
// export a function
|
||||
EXPORT DValue* test_func(DValue* call_param)
|
||||
{
|
||||
print("HELLO FROM TEST FUNCTION");
|
||||
return(0);
|
||||
}
|
||||
|
||||
// use that function in another file
|
||||
unit_call("call_file_funcs.uce", "test_func");
|
||||
```
|
||||
|
||||
Calling a named component handler through `unit_call()`:
|
||||
|
||||
```cpp
|
||||
DValue props;
|
||||
props["title"] = "Diagnostics";
|
||||
props["body"] = "Ready";
|
||||
|
||||
unit_call("components/card.uce", "COMPONENT:BODY", &props);
|
||||
```
|
||||
|
||||
Calling a page render handler through `unit_call()`:
|
||||
|
||||
```cpp
|
||||
DValue props;
|
||||
props["section"] = "summary";
|
||||
|
||||
unit_call("reports/summary.uce", "RENDER", &props);
|
||||
```
|
||||
|
||||
Related:
|
||||
|
||||
- PHP: `include`, `require`, or calling a function from an included module, especially when returning arrays or objects instead of rendering a view
|
||||
- JavaScript / Node.js: importing a module and calling an exported function, or dynamically loading a module and passing structured arguments
|
||||
:example
|
||||
print("unit_call example\n");
|
||||
|
||||
Reference in New Issue
Block a user