Skip to content

Commit

Permalink
Add load() function to extension.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrstegeman committed Apr 28, 2020
1 parent c87f795 commit 97f57a2
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
12,
]
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 8
Expand Down
8 changes: 7 additions & 1 deletion js/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@
super('example-extension');
this.addMenuEntry('Example Extension');

if (!window.Extension.prototype.hasOwnProperty('load')) {
this.load();
}
}

load() {
this.content = '';
fetch(`/extensions/${this.id}/views/content.html`)
return fetch(`/extensions/${this.id}/views/content.html`)
.then((res) => res.text())
.then((text) => {
this.content = text;
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"manifest_version": 1,
"name": "Example Extension",
"short_name": "Example",
"version": "0.1.0",
"version": "0.2.0",
"web_accessible_resources": [
"css/*.css",
"images/*.svg",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "example-extension",
"display_name": "Example Extension",
"version": "0.1.0",
"version": "0.2.0",
"description": "Example extension add-on for Mozilla WebThings Gateway",
"author": "Mozilla IoT",
"main": "index.js",
Expand Down

0 comments on commit 97f57a2

Please sign in to comment.