node-osmosis icon indicating copy to clipboard operation
node-osmosis copied to clipboard

debug error after stop instance

Open msolecki opened this issue 7 years ago • 2 comments

osmosis.data(data => {
osmosis.stop()
})

give me error that can't do debug() on undefined. the same with pause()

msolecki avatar Feb 14 '18 20:02 msolecki

Try this or this.instance instead of osmosis. Obviously you need full function instead of arrow-function to use this

samogot avatar May 12 '18 19:05 samogot

Was experiencing the same problem, with reference to test/stop.js and the above comment I was able to solve my issue.

https://github.com/rchipka/node-osmosis/blob/fc29b42e9a22945fc8873f44c83b92998cf77a8f/test/stop.js

  1. Assign osmosis command to a variable
  2. Call stop on this variable
const instance = osmosis
    .post('url', { key: 'value' })
    .set({
        key: 'selector'
    })
    .data(data => { 
        if (condition) { 
            instance.stop(); 
        } 
    });

webstercharly avatar May 20 '18 09:05 webstercharly