GithubHelp home page GithubHelp logo

Comments (4)

reachspirit avatar reachspirit commented on July 21, 2024

I've been looking for methods of data persistence. The serialize method provided by atom applies typically to classes, while we need to store a global variable history in our case.

https://www.npmjs.com/package/jsonfile

This package provides a way to read from and write to JSON, but I don't know whether it works with local files, for a browser would forbid cross domain access.

from csc-510-group-g.

arjunmadan avatar arjunmadan commented on July 21, 2024

Definitely possible to use this. You can write to the file when Atom closes, or even when you copy/cut and then read from it when Atom opens again or initializes.

You might want to take a look at https://nodejs.org/api/fs.html as well. It's what I'm using for the telemetry part so if you take a look at the code I've added to the telemetry, you should have an example on how to implement reading/writing to a file.

from csc-510-group-g.

arjunmadan avatar arjunmadan commented on July 21, 2024

How'd you implement it would be:

  1. Add the package to package.json and then run apm install.
  2. Add fs = require 'fs' to the top of the file where you're declaring the external modules/packages being used.
  3. Add the readFile function call to the init method and then populate the clipboard, and call appendFile whenever you copy something so that it's stored in the file. (Alternately there might be a shutdown or close method by Atom, and you could just copy the entire contents of the clipboard when this is called.)

from csc-510-group-g.

reachspirit avatar reachspirit commented on July 21, 2024

Thanks for the suggestion! I have managed to preserve the data with serialize method. Not in a standard way, but it's simple and effective.

from csc-510-group-g.

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.