123456789101112131415161718192021222324252627282930313233343536 |
- /**
- * Wrapper around a HTML element holding messages.
- *
- * @param id
- * The DOM ID of the element.
- *
- * @constructor
- */
- function MessageElement(id) {
- "use strict";
- /**
- * Private reference to the DOM element holding messages.
- *
- * @type {HTMLElement}
- */
- var element;
- /**
- * Private initializer.
- *
- * @param id
- */
- function init(id) {
- element = document.getElementById(id);
- if (!element) {
- throw new Error("Element id " + id + " not found in the DOM.");
- }
- }
- this.set = function (message) {
- element.innerHTML = message;
- };
- init(id);
- }
|