parser.pause() #65

Closed
wants to merge 8 commits into
from

5 participants

@pgte

Added support for parser.pause() with the following semantics:

After a parser.pause(), no events should be emitted before the next parser.resume(), even if parser.write() is invoked.

Needed to slightly modify:

  • parser.write(): to detect pauses and buffer the chunk if parser is paused.
  • parser.resume(): to resume all the pending buffers that were written while paused.
  • parser.pause(): to set the pausing state, to be detected in parser.write().

Added test test/pause.js that takes a large xml chunk, breaks it in pieces and:

  • asserts that no event is emitted while paused.
  • asserts that the order of all events is as expected.

Documented parser.pause in README.

@pgte

Found this problem when .end() occurs while it's paused, will have to come back, sorry.

@pgte pgte closed this Mar 23, 2012
@pgte pgte reopened this Mar 23, 2012
@pgte pgte referenced this pull request in substack/node-trumpet Sep 15, 2012
Closed

composing #6

@isaacs
Owner

I'd like to pull this in, but it doesn't apply cleanly. would you mind rebasing onto the current master, and squash down to one or two commits?

@andrewrk andrewrk referenced this pull request Jul 22, 2013
Closed

parser.pause() #107

@bslayton

Can we get this pull request accepted? I could really use parser.pause()

@lysdexia

Anything happening with this? It would make my life complete.

@bslayton

That's a bit humorous. parser.pause() = life complete. Sorry. Had to state the obviously cheesy. :neckbeard:

@mcouzinet

+1 for this feature !

@isaacs
Owner

Superseded by #107

@isaacs isaacs closed this Apr 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment