Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Fork wiki #8

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
bower_components
build
.dat
.DS_Store
.idea
node_modules
24 changes: 24 additions & 0 deletions dat-archive-idb-polyfill.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Setup storage to indexdb
const DefaultManager = DatArchive.DefaultManager

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may want to add code here to double check that DatArchive.DefaultManager exists before trying to set the manager. (for when the code is loaded in beaker)

class PersistantManager extends DefaultManager {
constructor () {
// super('http://gateway.mauve.moe:3000')
// super()
super('http://127.0.0.1:3000')
}

getStorage (key) {
return randomAccessIdb(`dat://${key}/`)
}

queryStorage() {
return 'idb'
}
}

// Only patch global if it doesn't exist
// Makes this a polyfill!
// if (!window.DatArchive) {
DatArchive.setManager(new PersistantManager())
window.DatArchive = DatArchive
// }
Loading