constmetamask=require('metamascara')
constEthJs=require('ethjs')
// mascara will use the environmental provider if the user brings one// in the form of metamask extension, mist or parity// other wise it will make one for you :}constethereumProvider=metamask.createDefaultProvider()
consteth=newEthJs(ethereumProvider)
// do stuff...

Developing:

constmetamask=require('metamascara')
constethereumProvider=metamask.createDefaultProvider({
host:'http://localhost:9001'
}) // or what ever port you use

How does it work and how to use it:

Mascara is an iframe that acts as a proxy between your dapp and metamask core.
The metamask core is the global context housed in a service worker, it does the
key management for every dapp the user visits.

todo's:

have an option to load metamask core off IPFS (relies on metamask issue 2163)