isaacs/sax-js — pull request #65 by pgte (2012-03-23 11:02:10+00:00)
Title: parser.pause()

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.