Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
docs: enhance code style in examples (#1609)
Browse files Browse the repository at this point in the history
* Use template literal

* Use const instead of var

* Remove spaces from textarea
  • Loading branch information
Otto-AA authored and Alan Shaw committed Oct 15, 2018
1 parent 48e4810 commit 9e410c6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/browser-add-readable-stream/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/* global Ipfs */
/* eslint-env browser */

const repoPath = 'ipfs-' + Math.random()
const repoPath = `ipfs-${Math.random()}`
const ipfs = new Ipfs({ repo: repoPath })

ipfs.on('ready', () => {
Expand Down
3 changes: 1 addition & 2 deletions examples/browser-browserify/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
</head>
<body>
<h1>JS IPFS - Add data to IPFS from the browser</h1>
<textarea id="source">
</textarea>
<textarea id="source"></textarea>
<button id="store">add to ipfs</button>
<div>
<div>found in ipfs:</div>
Expand Down
4 changes: 2 additions & 2 deletions examples/browser-browserify/src/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
'use strict'

var IPFS = require('ipfs')
const IPFS = require('ipfs')

const node = new IPFS({ repo: String(Math.random() + Date.now()) })

node.once('ready', () => console.log('IPFS node is ready'))

function store () {
var toStore = document.getElementById('source').value
const toStore = document.getElementById('source').value

node.files.add(Buffer.from(toStore), (err, res) => {
if (err || !res) {
Expand Down

0 comments on commit 9e410c6

Please sign in to comment.