krux / postscribe

Asynchronously write javascript, even with document.write.
MIT License
986 stars 156 forks source link

Inconsistent wording #475

Open eligrey opened 6 years ago

eligrey commented 6 years ago

In your readme, it says "PostScribe lets you deliver a synchronous ad asynchronously without modifying the ad code.". Later on in the usage section it shows that you need to modify ad code to use postscribe instead of document.write.

Are you able to use document.write() in its normal syntax asynchronously after including postscribe?

qlxucn commented 6 years ago

Same question.

jnewman commented 6 years ago

Sorry, the question is a bit unclear. Your code on the page must change to use this lib; what you don't need to change is the code that's coming from the remote script call.

If you're looking to wrap document.write on your page, then you could implement that by overriding the implementation and passing all the calls to postscribe.

The goal of this lib is to allow you to switch the ad calls in your page to a function call to postscribe, which will then queue up the remote calls (handling nesting) so that e.g., ad code that relies on a variable defined in a remote script waits to execute until the remote script executes completely. The benefit being that the remote fetches are now async instead of sync (as they would've been using doc.write w/ a script passed into the call).