Skip to content

Commit

Permalink
Example of adding data fields
Browse files Browse the repository at this point in the history
  • Loading branch information
mayfield committed Jan 17, 2024
1 parent 3b87556 commit be75bfe
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
24 changes: 24 additions & 0 deletions contents/add_a_data_field.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import('/pages/src/fields.mjs').then(module => {
module.fieldGroupNames['bike'] = 'Bike/Trainer';
module.fields.push({
group: 'bike',
id: 'bike-gear',
key: 'Gear',
value: () => Math.random() * 22 + 1 | 0,
});
});

if (electron.context.type === 'watching') {
import('/pages/src/watching.mjs').then(module => {
module.groupSpecs.bike = {
title: 'Bike/Trainer',
fields: [{
id: 'bike-gear',
longName: 'Virtual Gear',
value: x => Math.random() * 22 + 1 | 0,
key: 'Gear',
label: 'gear',
}],
};
});
}
5 changes: 3 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
"name": "The Neato Mod",
"description": "I make things neato",
"author": "Justin Mayfield",
"website_url": "https://saucellc.io",
"version": "0.0.1",
"website_url": "https://www.sauce.llc",
"version": "0.0.2",
"content_js": [
"contents/run_everywhere.js",
"contents/add_a_data_field.js",
"contents/theme.js"
],
"content_css": [
Expand Down

0 comments on commit be75bfe

Please sign in to comment.