-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get Version from extension #7
Comments
Sure thing. My thoughts on this are that one of the options that should be expressed in the screenshare options is the required extension version string. I'm thinking this should be expressed as a semver (or semver-like) version string, e.g. In terms of doing this, we have a couple of node packages that are available to help us do this:
Let me know what works best for you guys and I'll go with that :) |
That's perfect. We are happy to use slimver :) isExtensionInstalled() // returns true if extension is found in chrome.
isExtensionEnabled() // returns true if extension is installed and enabled(responding)
getExtensionVersion() // returns the version string
isMinimumVersionMet(minVersion) // returns true if installed version is above provided minVersion |
Sure thing, we can have functions like this, but they will have to be asynchronous. I'd propose the following: screenshare.getExtensionInfo(function(err, data) {
// handle errors, i.e. if the plugin is not installed an error will be raised
if (err && err.code === 'EXTENSION_UNAVAILABLE') {
return launchExtensionInstallProcess();
}
else if (err) {
return console.error('Encountered error requesting extension info: ', err);
}
console.log('extension available, version: ' + data.version);
}); And the min version function would look something like: screenshare.extensionVersionMatches('^2.2.0', function(err) {
if (err) {
console.error('screenshare extension not installed, or not compatible with requested version');
}
}); Writing the function in this way would allow you to do something nice, using the One thing I'm not sure about is how to provide info on how to check whether the extension is enabled, but I'll investigate that. |
Sure Damon, I like asynchronous approach. I've done some the investigation with chrome extensions detection. Following approach works even if extension is disabled. var imgsrc = "chrome-extension://" + extensionId + "/icon48.png";
var img;
img = new Image();
img.src = imgsrc;
img.onload = function () {
isExtensionInstalled = true;
};
img.onerror = function () {
isExtensionInstalled = false;
}; If the extension is disabled, it won't listen to request message from webpage and hence won't respond, so its easy to detect if extension is enabled or disabled. |
Implemented in |
We need a way for web page to determine the installed extension version number so that it can prompt user to update extension if required.
The text was updated successfully, but these errors were encountered: