get identity name via regex from l10nID
This commit is contained in:
parent
059b4bcaf9
commit
e286c2a3d4
1 changed files with 5 additions and 1 deletions
|
@ -1,7 +1,11 @@
|
|||
const IDENTITY_L10NID_MATCH_INDEX = 1;
|
||||
|
||||
browser.runtime.sendMessage('get-identities').then(reply=> {
|
||||
if (reply) {
|
||||
reply.content.identities.forEach(identity=> {
|
||||
document.querySelector('.identities-list').innerHTML += `<li><a href="#">${identity.icon}</a></li>`;
|
||||
const identityName = identity.l10nID.match(/userContext(\w*)\.label/)[IDENTITY_L10NID_MATCH_INDEX];
|
||||
|
||||
document.querySelector('.identities-list').innerHTML += `<li><a href="#">${identityName}</a></li>`;
|
||||
});
|
||||
console.log('response from sdk addon: ', reply.content);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue