8 Mart 2010, PAZARTESİ
Chrome tespit uzantısı ilk çalıştırma / güncelleme
Nasıl bir uzantı ilk defa çalıştırmak ya da sadece uzantısı bazı belirli eylemleri gerçekleştirmek böylece güncellendi, olduğunu bulabilir mi? (örneğin bir yardım sayfası veya güncelleme ayarları) açın
CEVAP
8 Mart 2010, PAZARTESİ
Eğer varsa uzantısı yüklü veya güncellenmiş olup olmadığını kontrol etmek istiyorsanız, bu gibi bir şey yapabilirsiniz:
function onInstall() {
console.log("Extension Installed");
}
function onUpdate() {
console.log("Extension Updated");
}
function getVersion() {
var details = chrome.app.getDetails();
return details.version;
}
// Check if the version has changed.
var currVersion = getVersion();
var prevVersion = localStorage['version']
if (currVersion != prevVersion) {
// Check if we just installed this extension.
if (typeof prevVersion == 'undefined') {
onInstall();
} else {
onUpdate();
}
localStorage['version'] = currVersion;
}
Bunu Paylaş:
Chrome Uzantısı bina - İçerik sayfası ...
Chrome uzantısı: içerik komut dosyası ...
Nasıl doğrudan bir Google Chrome Uzant...
Chrome Uzantısı İleti gönderme: yanıt ...
Okumak için burada bir Chrome uzantısı...