Newer
Older
* Fires once the content script worker is initialized.
*
* @event worker:initialized
* @param {Object} initialState The initial state of the settings module.
self.port.once('worker:initialized', function (initialState) {
});
self.port.on('preference:fetched', function () {
// TODO Re-render the user interface.
});
/**
* Applies a given localization to marked document elements.
* https://bugzilla.mozilla.org/show_bug.cgi?id=787351
*
* @private
* @param {Object} l10n A localization object.
function applyL10n (l10n) {
var l10nKeys = Object.keys(l10n);
l10nKeys.forEach(function (l10nKey) {
var elements = document.querySelectorAll('[data-l10n-id="' + l10nKey + '"]');
for (let element of elements) {
element.textContent = l10n[l10nKey];
}
});
}