Skip to content
This repository was archived by the owner on Dec 2, 2024. It is now read-only.
/ level-js Public archive

Actually support overriding default options#53

Closed
philschatz wants to merge 1 commit intoLevel:masterfrom
philschatz:master
Closed

Actually support overriding default options#53
philschatz wants to merge 1 commit intoLevel:masterfrom
philschatz:master

Conversation

@philschatz
Copy link

Thank you for a great library!

At a glance, the current code looks like it would work but xtend does not modify the first argument; it always returns a new object.

I ran into this because I wanted to override the IndexedDB name used so I can query for indexes other than the primary key as part of a Serverless Issue-tracking Board side-project.

@juliangruber
Copy link
Member

+1

@philschatz
Copy link
Author

Oh, you also wrote voxel.js! A couple years ago I dabbled making a 2-D+ video game that ended up using voxel.js. Examples:

And, it seems like you might be in Portland; want to grab ☕ some time?


Oh, it looks like you're looking for a ticket tracker! Here's a link that combines Issues from multiple repositories and uses a custom RegExp for determining which labels to use as columns: http://philschatz.com/gh-board/#/r/maxogden:dat|level.js|mafintosh:hyperdrive|substack:level-party?x=[a-z] (you can always npm start locally if you don't trust gh-pages with a token)


Some other side-projects:

@ralphtheninja
Copy link
Member

@vweevers Should we pull this functionality in by another PR?

@vweevers
Copy link
Member

It will probably change if and when we remove idbwrapper. Let's keep this open as a reminder.

This was referenced May 23, 2018
@vweevers
Copy link
Member

@philschatz this is old, but can you explain what you meant by:

I ran into this because I wanted to override the IndexedDB name used

@vweevers
Copy link
Member

Closing this because of #88. Feel free to open a new issue if your use case isn't covered.

@vweevers vweevers closed this May 25, 2018
@philschatz
Copy link
Author

philschatz commented May 25, 2018

@vweevers It has been a few years since I looked at this code but I think that xtend(firstArg, secondArg) does not modify firstArg but rather it returns a new object.

Therefore, there was no way to change the arguments that were passed in when constructing a new IDB(idbOpts). I think I had wanted to change one of the defaults listed in https://github.com/Level/level.js/pull/53/files#diff-168726dbe96b3ce427e7fedce31bb0bcR23

Hope that helps!

PS: Here is the code that used level.js: https://github.com/philschatz/gh-board/blob/458766d075664d65e53f8841c39b8ad04b8ee402/src/database.js#L103-L109 and https://github.com/philschatz/gh-board/blob/458766d075664d65e53f8841c39b8ad04b8ee402/src/github-client.js#L44-L56

@vweevers
Copy link
Member

@philschatz Thanks! We've since removed IDBWrapper, so there are no idbOpts anymore. But we'll write an upgrade guide, so if and when you update your code you should be able to map old options to new. All the options I see in your gh-board code are supported (in a different form) except for indexes.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants