SORU
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ş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • jesiel santos

    jesiel santo

    15 Ocak 2009
  • Monica Catral

    Monica Catra

    12 NİSAN 2009
  • SunsetTrance

    SunsetTrance

    20 EYLÜL 2008