Skip to content

Commit be75bfe

Browse files
committed
Example of adding data fields
1 parent 3b87556 commit be75bfe

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

contents/add_a_data_field.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import('/pages/src/fields.mjs').then(module => {
2+
module.fieldGroupNames['bike'] = 'Bike/Trainer';
3+
module.fields.push({
4+
group: 'bike',
5+
id: 'bike-gear',
6+
key: 'Gear',
7+
value: () => Math.random() * 22 + 1 | 0,
8+
});
9+
});
10+
11+
if (electron.context.type === 'watching') {
12+
import('/pages/src/watching.mjs').then(module => {
13+
module.groupSpecs.bike = {
14+
title: 'Bike/Trainer',
15+
fields: [{
16+
id: 'bike-gear',
17+
longName: 'Virtual Gear',
18+
value: x => Math.random() * 22 + 1 | 0,
19+
key: 'Gear',
20+
label: 'gear',
21+
}],
22+
};
23+
});
24+
}

manifest.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
"name": "The Neato Mod",
44
"description": "I make things neato",
55
"author": "Justin Mayfield",
6-
"website_url": "https://saucellc.io",
7-
"version": "0.0.1",
6+
"website_url": "https://www.sauce.llc",
7+
"version": "0.0.2",
88
"content_js": [
99
"contents/run_everywhere.js",
10+
"contents/add_a_data_field.js",
1011
"contents/theme.js"
1112
],
1213
"content_css": [

0 commit comments

Comments
 (0)