Add support for using within a worker thread

I am doing some comparisons on giant objects, and they take a long while to do the comparisons. So much so that it's not feasible for me to be able to perform them on the UI thread. This change allows jsondiffpatch to also be used from within a worker thread, where window is not available and you only have access to self.