| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [View Raw Code] [Original HTTPS Page] |
Mist provides an API for dapp developers to use special features only available in Mist.
To make your dapp compatible with other browsers, it is recommended that you check the mist object before you use it:
if(typeof mist !== 'undefined') {
...
}You have three different possibilities to use web3:
// 1. simply use it: web3 comes already defined
web3
// 2. optionally use web3 from Mist or load if outside of Mist
if(typeof web3 === 'undefined')
web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
// 3. always use web3 provided by the dapp ("Web3" won't be supplied by Mist), but the provider from Mist
if(typeof web3 !== 'undefined')
web3 = new Web3(web3.currentProvider);
else
web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));Returns the current platform, mist is running on:
Asks the user to provide, or create a new account.
mist.requestAccount(function(e, address){
console.log('Added new account', address);
});Provides functionality to control the sub menu of your dapp, when its added to the sidebar.
Adds/Updates a sub menu entry, which is placed below you dapp button in the sidebar.
mist.menu.add({name: 'My account'});mist.menu.add('tkrzU', {
name: 'My Meny Entry',
badge: 50,
position: 1,
selected: true
}, function(){
// Redirect
window.location = 'http://domain.com/send';
// Using history pushstate
history.pushState(null, null, '/my-entry');
// In Meteor iron:router
Router.go('/send');
})Removes all sub menu entries. You can use this when you reload your app, to clear up incorrect menu entries, which might have been lost since the last session.
None
Removes a sub menu entry.
Selects the respective sub menu entry.
Sets the main badge of your dapp, right below your dapps menu button.
Works like mist.menu.add(), but only the id parameter is required.
mist.menu.update('tkrzU', {
badge: 50,
position: 2,
})Provides a list of sounds.
Makes a bip sound.
None
Makes a bloop sound.
None
Makes an invite sound.
None
| Back | FazBrowse Home | New Git URL |