hypothesis/dom-text-mapper — pull request #29 by csillag (2014-01-20 22:51:25+00:00)
Title: Move to a truly async API, hiding all internal details of scanning

Until now, some methods on the API of dom-text-mapper needed to do some
internal housekeeping, before they could actually calculate and return
correct results. But some of this house-keeping can not be done in a synchronos
way over PDF documents, and so to preserve comatibility on the API of
dom-text-mapper and all it's descendants, we are now moving to a fully async
API.

This means that before calling any of the impacted methods (listed below),
you should first call the `ready()` method with a callback, and the d-t-m
is ready for your queries, it will call your callback with a `state` object,
and you can then execute your queries on the returned `state` object.

This impacts the following methods:
* `getInfoForPath()`
* `getInfoForNode()`
* `getContentForPath()`
* `getLengthForPath()`
* `getDocLength()`
* `getCorpus()`
* `getContextForCharRange()`
* `getMappingsForCharRange()`
* `getMappingsForCharRanges()`
* `getIndexForPos()`

It is no longer supported to call these methods directly on d-t-m, they are
only exposed on the `state` object, which is passed with the callback,
after `ready()` has finished the housekeeping.

This fixes #28.