2017-03-31 03:33:19 +02:00
|
|
|
const extension = require('extensionizer')
|
|
|
|
|
|
|
|
class ExtensionPlatform {
|
|
|
|
|
|
|
|
//
|
|
|
|
// Public
|
|
|
|
//
|
|
|
|
reload () {
|
|
|
|
extension.runtime.reload()
|
|
|
|
}
|
|
|
|
|
|
|
|
openWindow ({ url }) {
|
|
|
|
extension.tabs.create({ url })
|
|
|
|
}
|
|
|
|
|
2017-04-01 03:04:13 +02:00
|
|
|
getVersion () {
|
|
|
|
return extension.runtime.getManifest().version
|
|
|
|
}
|
|
|
|
|
2018-07-02 21:14:31 +02:00
|
|
|
openExtensionInBrowser (route = null) {
|
|
|
|
let extensionURL = extension.runtime.getURL('home.html')
|
|
|
|
if (route) {
|
|
|
|
extensionURL += `#${route}`
|
|
|
|
}
|
2017-12-09 01:48:08 +01:00
|
|
|
this.openWindow({ url: extensionURL })
|
|
|
|
}
|
|
|
|
|
2017-10-04 19:55:10 +02:00
|
|
|
getPlatformInfo (cb) {
|
2017-10-06 02:13:58 +02:00
|
|
|
try {
|
2017-10-10 17:36:15 +02:00
|
|
|
extension.runtime.getPlatformInfo((platform) => {
|
|
|
|
cb(null, platform)
|
|
|
|
})
|
2017-10-06 02:13:58 +02:00
|
|
|
} catch (e) {
|
2017-10-10 17:36:15 +02:00
|
|
|
cb(e)
|
2017-10-06 02:13:58 +02:00
|
|
|
}
|
2017-10-04 18:56:18 +02:00
|
|
|
}
|
2017-03-31 03:33:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = ExtensionPlatform
|