Add local browser example

This commit is contained in:
Michael Vines
2018-08-23 08:12:51 -07:00
parent ad95cb5c32
commit 36df1b1e5e
4 changed files with 58 additions and 15 deletions

View File

@ -0,0 +1,3 @@
## Examples
Before trying any of the examples in this directory please populate the `lib/`
directory by running `npm install`

View File

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<title>Create a new account</title>
</head>
<body>
<b>Account Public Key:</b>
<div id="accountPublicKey">?</div>
<script src="../lib/index.iife.js"></script>
<script>
// Create a new account
const account = new solanaWeb3.Account();
// Display the account's public key
const accountPublicKey = document.getElementById('accountPublicKey');
accountPublicKey.innerHTML = account.publicKey;
</script>
<p>
<i>This demo is also available on <a href="https://jsfiddle.net/mvines/sz4pco6y/">JSFiddle</a></i>
</body>
</html>

View File

@ -1,11 +1,5 @@
/*
Creating a new account
Usage:
$ npm run dev
$ node ./account.js
Create a new account
*/
//eslint-disable-next-line import/no-commonjs