diff options
Diffstat (limited to 'src/js')
-rw-r--r-- | src/js/agl_stubs_bluetooth.js | 29 | ||||
-rw-r--r-- | src/js/agl_stubs_network.js | 7 | ||||
-rw-r--r-- | src/js/bluetooth.js | 2 | ||||
-rw-r--r-- | src/js/templates.js | 4 | ||||
-rw-r--r-- | src/js/wifi.js | 2 | ||||
-rw-r--r-- | src/js/wired.js | 2 |
6 files changed, 41 insertions, 5 deletions
diff --git a/src/js/agl_stubs_bluetooth.js b/src/js/agl_stubs_bluetooth.js new file mode 100644 index 0000000..34b92e0 --- /dev/null +++ b/src/js/agl_stubs_bluetooth.js @@ -0,0 +1,29 @@ +export function managed_objects() { + return new Promise((resolve, reject) => { + resolve({ + devices: [] + }) + }); +} + + +let _powered = false + +export function adapter_state(new_state) { + return new Promise((resolve, reject) => { + if (typeof new_state !== undefined) + _powered = new_state.powered; + resolve({ + powered: _powered + }); + }); +} + +export function pair() { +} + +export function connect() { +} + +export function disconnect() { +}
\ No newline at end of file diff --git a/src/js/agl_stubs_network.js b/src/js/agl_stubs_network.js new file mode 100644 index 0000000..b0e6823 --- /dev/null +++ b/src/js/agl_stubs_network.js @@ -0,0 +1,7 @@ +export function services() { + return new Promise((resolve, reject) => { + resolve({ + values: [] + }); + }); +} diff --git a/src/js/bluetooth.js b/src/js/bluetooth.js index 258a8a7..6793feb 100644 --- a/src/js/bluetooth.js +++ b/src/js/bluetooth.js @@ -1,4 +1,4 @@ -import { bluetooth } from 'agl-js-api'; +import * as bluetooth from './agl_stubs_bluetooth'; import Mustache from 'mustache'; import { load as load_template } from './templates'; import * as app from './app'; diff --git a/src/js/templates.js b/src/js/templates.js index 2513722..4b71638 100644 --- a/src/js/templates.js +++ b/src/js/templates.js @@ -2,12 +2,12 @@ export function load(template) { return new Promise(function(resolve, reject){ var xhr = new XMLHttpRequest(); - xhr.open('GET', '/templates/'+template); + xhr.open('GET', './templates/'+template); xhr.send(); xhr.onload = function() { - if (xhr.status != 200) { + if (xhr.status != 200 && xhr.status != 0) { console.error('Error loading template', xhr.status, xhr.statusText); reject(xhr.status); } else { diff --git a/src/js/wifi.js b/src/js/wifi.js index 15d9173..49a2543 100644 --- a/src/js/wifi.js +++ b/src/js/wifi.js @@ -1,4 +1,4 @@ -import { network } from 'agl-js-api'; +import * as network from './agl_stubs_network'; import Mustache from 'mustache'; import { load as load_template } from './templates'; import * as app from './app'; diff --git a/src/js/wired.js b/src/js/wired.js index c5407c8..c2e137e 100644 --- a/src/js/wired.js +++ b/src/js/wired.js @@ -1,4 +1,4 @@ -import { network } from 'agl-js-api'; +import * as network from './agl_stubs_network'; import Mustache from 'mustache'; import { load as load_template } from './templates'; import * as app from './app'; |