Add sync options for synchronous requests

This adds a `sync` option that will make a synchronous request when set to true. Note that the callback will be called synchronously in this case. Also, setting `timeout` is not supported when `sync` is true.

Synchronous requests are needed in some special cases, such as making a request when a page is being closed. These cases are rare, but it would be nice to still be able to use `xhr` for them.