diff options
Diffstat (limited to 'app/scripts/platforms')
-rw-r--r-- | app/scripts/platforms/extension.js | 23 | ||||
-rw-r--r-- | app/scripts/platforms/sw.js | 24 | ||||
-rw-r--r-- | app/scripts/platforms/window.js | 22 |
3 files changed, 69 insertions, 0 deletions
diff --git a/app/scripts/platforms/extension.js b/app/scripts/platforms/extension.js new file mode 100644 index 000000000..00c2aa275 --- /dev/null +++ b/app/scripts/platforms/extension.js @@ -0,0 +1,23 @@ +const extension = require('extensionizer') + +class ExtensionPlatform { + + // + // Public + // + + reload () { + extension.runtime.reload() + } + + openWindow ({ url }) { + extension.tabs.create({ url }) + } + + getVersion () { + return extension.runtime.getManifest().version + } + +} + +module.exports = ExtensionPlatform diff --git a/app/scripts/platforms/sw.js b/app/scripts/platforms/sw.js new file mode 100644 index 000000000..007d8dc5b --- /dev/null +++ b/app/scripts/platforms/sw.js @@ -0,0 +1,24 @@ + +class SwPlatform { + + // + // Public + // + + reload () { + // you cant actually do this + global.location.reload() + } + + openWindow ({ url }) { + // this doesnt actually work + global.open(url, '_blank') + } + + getVersion () { + return '<unable to read version>' + } + +} + +module.exports = SwPlatform diff --git a/app/scripts/platforms/window.js b/app/scripts/platforms/window.js new file mode 100644 index 000000000..1527c008b --- /dev/null +++ b/app/scripts/platforms/window.js @@ -0,0 +1,22 @@ + +class WindowPlatform { + + // + // Public + // + + reload () { + global.location.reload() + } + + openWindow ({ url }) { + global.open(url, '_blank') + } + + getVersion () { + return '<unable to read version>' + } + +} + +module.exports = WindowPlatform |