Added Chrome Strategy as a valid network strategy

This commit is contained in:
Andrew Bastin
2020-01-21 20:01:22 -05:00
parent a235d38240
commit 2d6d1b2d34

View File

@@ -1,8 +1,13 @@
import AxiosStrategy from "./strategies/AxiosStrategy";
import FirefoxStrategy from "./strategies/FirefoxStrategy";
import ChromeStrategy, { hasChromeExtensionInstalled } from "~/functions/strategies/ChromeStrategy";
const runAppropriateStrategy = (req, store) => {
// Chrome Provides a chrome object for scripts to access
// Check its availability to say whether you are in Google Chrome
if (window.chrome && hasChromeExtensionInstalled()) {
return ChromeStrategy(req, store);
}
// The firefox plugin injects a function to send requests through it
// If that is available, then we can use the FirefoxStrategy
if (window.firefoxExtSendRequest) {