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

fix: fixes browser script tag example #3034

Merged
merged 5 commits into from
May 14, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/browser-add-readable-stream/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</head>
<body>
<pre id="output"></pre>
<script src="./node_modules/ipfs/dist/index.js"></script>
<script src="./node_modules/ipfs/dist/index.min.js"></script>
<script src="index.js"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion examples/browser-browserify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
"test-ipfs-example": "^2.0.1"
},
"browser": {
"ipfs": "ipfs/dist/index.js"
"ipfs": "ipfs/dist/index.min.js"
}
}
12 changes: 7 additions & 5 deletions examples/browser-script-tag/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<title>IPFS in the Browser</title>
<script src="./node_modules/ipfs/dist/index.js"></script>
<script src="./node_modules/ipfs/dist/index.min.js"></script>
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', async () => {
const node = await Ipfs.create({ repo: 'ipfs-' + Math.random() })
Expand Down Expand Up @@ -31,8 +31,9 @@ <h2>Some suggestions</h2>

<code style="display:block; white-space:pre-wrap; background-color:#d7d6d6">
async function addFile () {
const filesAdded = await node.add('Hello world!')
filesAdded.forEach((file) => console.log('successfully stored', file.hash))
for await (const { cid } of node.add('Hello world!')) {
console.log('successfully stored', cid)
}
}

addFile()
Expand All @@ -42,8 +43,9 @@ <h2>Some suggestions</h2>

<code style="display:block; white-space:pre-wrap; background-color:#d7d6d6">
async function catFile () {
const data = await node.cat('QmQzCQn4puG4qu8PVysxZmscmQ5vT1ZXpqo7f58Uh9QfyY')
console.log(data.toString())
for await (const data of node.cat('QmQzCQn4puG4qu8PVysxZmscmQ5vT1ZXpqo7f58Uh9QfyY')) {
console.log(data.toString())
}
}

catFile()
Expand Down
2 changes: 1 addition & 1 deletion examples/browser-video-streaming/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<html>
<body>
<video id="video" controls></video>
<script src="./node_modules/ipfs/dist/index.js"></script>
<script src="./node_modules/ipfs/dist/index.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/hlsjs-ipfs-loader@latest/dist/index.js"></script>
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
<script src="streaming.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion packages/ipfs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ You can load IPFS right in your browser by adding the following to your page usi
<script src="https://cdn.jsdelivr.net/npm/ipfs/dist/index.min.js"></script>

<!-- loading the human-readable (not minified) version jsDelivr -->
<script src="https://cdn.jsdelivr.net/npm/ipfs/dist/index.js"></script>
<script src="https://cdn.jsdelivr.net/npm/ipfs/dist/index.min.js"></script>
```

Inserting one of the above lines will make an `Ipfs` object available in the global namespace:
Expand Down