Skip to content
This repository was archived by the owner on Jul 28, 2025. It is now read-only.

Commit ce61b55

Browse files
committed
docu
1 parent c25d291 commit ce61b55

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

docs/docs/features/Formulas.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,26 @@ The root object `db` has the following functions:
2828
- `dataview`: expose the dataview API. (see [Dataview API](https://github.com/blacksmithgu/obsidian-dataview/blob/master/src/api/plugin-api.ts))
2929
- `rollup`: expose the rollup functions of the dbfolder plugin. (see [Rollup documentation](/features/Relations/#rollups))
3030

31+
#### Javascript file structure
32+
To add a javascript file to the `js` folder, it must be a `.js` file and have the following structure:
33+
34+
```javascript
35+
function optionalFunction( arg1, arg2){
36+
// do something
37+
return value
38+
}
39+
40+
// Your main function inside the file (arguments are optional)
41+
function myFunction(arg1, arg2) {
42+
// do something
43+
// You can use another functions defined in the file
44+
return result;
45+
}
46+
47+
// expose the main function to the formula
48+
module.exports = myFunction;
49+
```
50+
3151
## Examples
3252

3353
If you have a column ID named "Date" you can add time:

0 commit comments

Comments
 (0)