You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
117 lines
3.4 KiB
117 lines
3.4 KiB
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="google" content="notranslate">
|
|
<meta http-equiv="Content-Language" content="en">
|
|
<title>platforms/extension.js - Documentation</title>
|
|
|
|
<script src="scripts/prettify/prettify.js"></script>
|
|
<script src="scripts/prettify/lang-css.js"></script>
|
|
<script
|
|
src="https://code.jquery.com/jquery-3.1.1.min.js"
|
|
integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8="
|
|
crossorigin="anonymous"></script>
|
|
<script src="scripts/semantic.min.js"></script>
|
|
<!--[if lt IE 9]>
|
|
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
<![endif]-->
|
|
<link type="text/css" rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
|
|
<link type="text/css" rel="stylesheet" href="styles/prettify.css">
|
|
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
|
|
<link type="text/css" rel="stylesheet" href="styles/semantic.min.css">
|
|
<link type="text/css" rel="stylesheet" href="styles/override.css">
|
|
</head>
|
|
<body>
|
|
|
|
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
|
|
<label for="nav-trigger" class="navicon-button x">
|
|
<div class="navicon"></div>
|
|
</label>
|
|
|
|
<label for="nav-trigger" class="overlay"></label>
|
|
|
|
<nav>
|
|
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><div class="ui vertical accordion"><div class="title"><div class="ui list"><div class="item"><i class="inverted dropdown icon"></i><a href="module.exports_module.exports.html">exports</a></div></div></div></li></div></ul><h3><a href="global.html">Global</a></h3>
|
|
</nav>
|
|
|
|
<div id="main">
|
|
|
|
<h1 class="page-title">platforms/extension.js</h1>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<section>
|
|
<article>
|
|
<pre class="prettyprint source linenums"><code>const extension = require('extensionizer')
|
|
|
|
/**
|
|
* An object that provides a variety of platform-specific functions.
|
|
*
|
|
* @typedef {object} Platform
|
|
*
|
|
* @property {Function} reload - A function to reload the application.
|
|
* @property {Function} openWindow - Opens a URL in the web browser.
|
|
* @property {Function} getVersion - Gets the current version of MetaMask.
|
|
* @property {Function} openExtensionInBrowser - Opens the MetaMask UI in a full window.
|
|
* @property {Function} getPlatformInfo - Callback function that returns info about the current platform.
|
|
*/
|
|
|
|
class ExtensionPlatform {
|
|
|
|
//
|
|
// Public
|
|
//
|
|
reload () {
|
|
extension.runtime.reload()
|
|
}
|
|
|
|
openWindow ({ url }) {
|
|
extension.tabs.create({ url })
|
|
}
|
|
|
|
getVersion () {
|
|
return extension.runtime.getManifest().version
|
|
}
|
|
|
|
openExtensionInBrowser () {
|
|
const extensionURL = extension.runtime.getURL('home.html')
|
|
this.openWindow({ url: extensionURL })
|
|
}
|
|
|
|
getPlatformInfo (cb) {
|
|
try {
|
|
extension.runtime.getPlatformInfo((platform) => {
|
|
cb(null, platform)
|
|
})
|
|
} catch (e) {
|
|
cb(e)
|
|
}
|
|
}
|
|
}
|
|
|
|
module.exports = ExtensionPlatform
|
|
</code></pre>
|
|
</article>
|
|
</section>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<br class="clear">
|
|
|
|
<footer>
|
|
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Apr 12 2018 14:37:39 GMT-0700 (PDT) using the radgrad jsdoc theme. Derived from docdash.
|
|
</footer>
|
|
|
|
<script>prettyPrint();</script>
|
|
<script src="scripts/linenumber.js"></script>
|
|
<script>$('.ui.accordion').accordion();</script>
|
|
</body>
|
|
</html>
|
|
|