Coder Social home page Coder Social logo

Unwatch modification about node-watch HOT 4 CLOSED

yuanchuan avatar yuanchuan commented on May 14, 2024
Unwatch modification

from node-watch.

Comments (4)

yuanchuan avatar yuanchuan commented on May 14, 2024

That's nice, would like to see any modifications and improvements!

from node-watch.

jvonmitchell avatar jvonmitchell commented on May 14, 2024

I'm realizing it was already in my fork. There is no explicit mention of close in the source code but you can now say.

var watch = watchFile('somepath',somecallback);
...
watch.close();

Here's a review of what it does. jvonmitchell@22e5936#diff-481962e7a473d9939d95e86648f023ee

All it does is expose the underlying listener so that you can close it. If any one wants to build a better return object that's ok with me. The idea is that the call to watch was exposing nothing so we might as well make it something.

One flaw with the way it is done is that it may return a listener or a [] so you have to watch for that. That's why there is a good argument for a better return object.

PS, yuanchuan: I want to apologize for writing something that may seem out of context. Someone emailed me asking for the updated code. I thought those emails were sent to me from this issue. Hence the sillyness. Feel free to use the changes I made.

from node-watch.

jvonmitchell avatar jvonmitchell commented on May 14, 2024

Ok. I now have a branch that returns an instance of an internal class that we can define behaviors for our return object in. I implemented close. More things could be implemented.

The branch is called returnObject.

from node-watch.

vallettea avatar vallettea commented on May 14, 2024

👍

from node-watch.

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.