Coder Social home page Coder Social logo

Add localestorage support about node-json-db HOT 5 OPEN

belphemur avatar belphemur commented on July 19, 2024
Add localestorage support

from node-json-db.

Comments (5)

ZaneHannanAU avatar ZaneHannanAU commented on July 19, 2024

Currently not possible without a rework (requires('') compatibility required for current implementation).

I'm working on it though, as one with Promises.

Not published, but see https://github.com/ZaneHannanAU/db-dot-json for more information.

from node-json-db.

Belphemur avatar Belphemur commented on July 19, 2024

@ZaneHannanAU Great work on implementing the Promises :)

I admit I gave up on Async as it was overkill for the usage I had of the lib at the time (hence the decision to use Sync filesystem calls).

from node-json-db.

ZaneHannanAU avatar ZaneHannanAU commented on July 19, 2024

@Belphemur The biggest issue with mine right now is that it doesn't work at all.

As in, not even the tests work lol


Anyway, once you go promise for one thing; everything else must become a promise.

from node-json-db.

Belphemur avatar Belphemur commented on July 19, 2024

@ZaneHannanAU Yep, Promises are a double edge sword. One that I didn't wanted to impose on the user.

Also at the time I started the lib, there were easily 5-6 differents promise lib...

from node-json-db.

Drarig29 avatar Drarig29 commented on July 19, 2024

@Belphemur I think an easier solution would be to:

  • Make the file persistance optional (for example by allowing null as a database filename in the JsonDB constructor)
  • Add a public method exposing the private field named data (maybe a copy for security concerns)
  • Let the user make his own solution (either outside of the library, or by passing a save callback function) to persist data manually
  • Persisting in json files would remain the default behavior

I can do it in a PR... I need this feature 😁

from node-json-db.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.