Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

345
Visualizações
What is the parameter inside the function parameter of the chrome.storage.sync.get() function?

I'm following the chrome extension tutorial https://developer.chrome.com/docs/extensions/mv3/getstarted/ right now and part of their example code takes, in the parameter of the get() method's function parameter, a {color} object:

let changeColor = document.getElementById("changeColor");

chrome.storage.sync.get("color", ({ color }) => {
  changeColor.style.backgroundColor = color;
});

From what I understand, this parameter represents an object that contains all the key-value pairs in storage. In storage, there exists one key-value pair, "color": "#3aa757" and was passed into storage using the line chrome.storage.sync.set({color}) where color had already been declared and assigned to "3aa757".

I am confused as to why the parameter here is typed as an object containing the variable name rather than just some arbitrary variable name like "data" or "result", as it is in the documentation:

chrome.storage.local.get(['key'], function(result) {
  console.log('Value currently is ' + result.key);
});

How are these options different?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda