Coder Social home page Coder Social logo

Comments (11)

feross avatar feross commented on May 22, 2024

Currently avoiding anything that requires native dependencies or grows the dependency graph in a big way.

+1

I don't think we need to track that much. A plain object that's JSON.stringify()able will work fine for most of our state. https://github.com/LinusU/node-application-config looks great to me.

from webtorrent-desktop.

feross avatar feross commented on May 22, 2024

I've generally been trying to put state that's ephemeral and can be thrown away on app exit into state.view. Stuff that's outside that (i.e. state.*) should be persisted to disk.

Right now, stuffs a bit disorganized there, but I think it's worth preserving a distinction here.

from webtorrent-desktop.

ungoldman avatar ungoldman commented on May 22, 2024

Maybe something like a state.session object would make sense to namespace all things that are session specific?

from webtorrent-desktop.

ungoldman avatar ungoldman commented on May 22, 2024

(thinking eventually other things will be session specific outside of managing view state)

from webtorrent-desktop.

ungoldman avatar ungoldman commented on May 22, 2024

Could use node-application-config to read/write from config to state.config too

from webtorrent-desktop.

feross avatar feross commented on May 22, 2024

@ngoldman That sounds fine to me

from webtorrent-desktop.

feross avatar feross commented on May 22, 2024

Why not use node-application-config to read/write the whole state object, minus state.session?

from webtorrent-desktop.

ungoldman avatar ungoldman commented on May 22, 2024

Whichever's easier 😜

from webtorrent-desktop.

dcposch avatar dcposch commented on May 22, 2024

node-application-config looks jank. 2 stars on github, 43 downloads this week.

it also doesn't do file locking as far as i can tell, so there's nothing to prevent two instances of the app running and clobbering each other's state files

from webtorrent-desktop.

feross avatar feross commented on May 22, 2024

@dcposch GitHub stars and downloads per week don't mean anything if the package works :)

I think it looks like a good start anyway, specifically how it stores state in the right OS-specific location: https://github.com/LinusU/node-application-config-path/blob/master/index.js

Maybe we can add locking in a PR?

from webtorrent-desktop.

ungoldman avatar ungoldman commented on May 22, 2024

Totally agree, it's not about the stars and downloads. That said, https://www.npmjs.com/package/application-config is the right package (not https://www.npmjs.com/package/node-application-config), which got about 11,353 downloads last month :)

from webtorrent-desktop.

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.