Skip to content

Commit ac7e915

Browse files
committed
add more example vault content
1 parent 6436286 commit ac7e915

File tree

3 files changed

+72
-0
lines changed

3 files changed

+72
-0
lines changed

exampleVault/Advanced Example.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
BaseSpeed: 50
3+
SpeedMultiplier: 1
4+
AdditionalBonus: 0
5+
Encumbered: false
6+
HorseshoesofSpeed: false
7+
HoursPerDay: 8
8+
MinutesPerMile: 20
9+
ExhaustionLevel: 0
10+
TravelDistance: 1000
11+
varMins: 60
12+
---
13+
14+
# Travel Speed Calculator
15+
16+
TODO

exampleVault/Meta Bind API.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
select: b
3+
---
4+
5+
## Creating an Input Field with JS Engine
6+
7+
JS Engine can be found [here](https://github.com/mProjectsCode/obsidian-js-engine-plugin).
8+
9+
**Code**
10+
```js
11+
const mb = engine.getPlugin('obsidian-meta-bind-plugin').api;
12+
13+
const options = ['a', 'b', 'c'];
14+
15+
// first, create an empty declaration
16+
let declaration = mb.inputField.createInputFieldDeclaration();
17+
// set the input field type
18+
declaration = mb.inputField.setType(declaration, 'select');
19+
// bind the input field to 'select'
20+
declaration = mb.inputField.setBindTargetMetadataField(declaration, 'select');
21+
22+
for (const option of options) {
23+
// add all the options
24+
declaration = mb.inputField.addArgument(declaration, {name: 'option', value: [option]});
25+
}
26+
27+
// create the input field in the container and pass in the component for life cycle management (container and component are globals exposed by js engine)
28+
mb.createInputField(declaration, 'block', context.file.path, container, component);
29+
```
30+
31+
**Resulting Input Field**
32+
```js-engine
33+
const mb = engine.getPlugin('obsidian-meta-bind-plugin').api;
34+
35+
const options = ['a', 'b', 'c'];
36+
37+
// first, create an empty declaration
38+
let declaration = mb.inputField.createInputFieldDeclaration();
39+
// set the input field type
40+
declaration = mb.inputField.setType(declaration, 'select');
41+
// bind the input field to 'select'
42+
declaration = mb.inputField.setBindTargetMetadataField(declaration, 'select');
43+
44+
for (const option of options) {
45+
// add all the options
46+
declaration = mb.inputField.addArgument(declaration, {name: 'option', value: [option]});
47+
}
48+
49+
declaration = mb.inputField.addArgument(declaration, {name: 'title', value: ['I was created using JS Engine and the Meta Bind API']});
50+
51+
// create the input field in the container and pass in the component for life cycle management (container and component are globals exposed by js engine)
52+
mb.createInputField(declaration, 'block', context.file.path, container, component);
53+
```
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## Task
2+
3+
Completed: `INPUT[toggle:completed]`

0 commit comments

Comments
 (0)