extract a coinhive.js core instead

hey after reading through the codebase that coin-hive provides, it makes a lot of reference to window and other browser features, wouldn't it be more feasible if someone managed to extract the mining code and the the code that connects to the servers and package it in a way that it can be used in another environment ie react-native or embed in ones own code to avoid blockers that are url based. how hard would it be to extract this parts and get them working without a window environment, which would also mean we may not need to use headless chrome