docs/api/core-greet_CoreGreetElement.js.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: core-greet/CoreGreetElement.js</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Source: core-greet/CoreGreetElement.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>import CoreElement from '../core-element/CoreElement';
import TEMPLATE from './CoreGreetElement.html';
import STYLE from './CoreGreetElement.css';
const CoreGreetTemplate = CoreElement.templateNode(TEMPLATE, STYLE);
/**
* An element that displays some greeting from the language mapping with the passed-in name,
* Currently supports 4 languages - Japanese, English, Spanish and French
* @property {string} name the string that will be displayed.
* @property {boolean} rainbow whether the name should be colorfully animated.
* @property {String} lang the language to display in.
*/
class CoreGreetElement extends CoreElement {
/** @private */
static get properties() {
return {
name: { type: String },
rainbow: { type: Boolean },
lang: { type: String },
};
}
/** Creates a CoreGreet element and attaches the shadow root. */
constructor(langMap = null) {
super(CoreGreetTemplate);
this.langMapping = langMap || { en: 'Greet' };
this.greetElement = this.shadowRoot.querySelector('#greet');
this.nameElement = this.shadowRoot.querySelector('#name');
this.name = 'World';
}
/** @private */
propertyChangedCallback(property, oldValue, newValue) {
switch (property) {
case 'name':
this.nameElement.textContent = newValue;
break;
case 'lang':
this.greetElement.textContent = this.langMapping[newValue] || this.langMapping.en;
break;
default:
}
}
}
CoreElement.customTag('core-greet', CoreGreetElement);
export default CoreGreetElement;
</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-CoreElement.html">CoreElement</a></li></ul><h3>Classes</h3><ul><li><a href="CoreByeElement.html">CoreByeElement</a></li><li><a href="CoreGreetElement.html">CoreGreetElement</a></li><li><a href="CoreHelloElement.html">CoreHelloElement</a></li><li><a href="CoreLinkElement.html">CoreLinkElement</a></li><li><a href="CoreSliderElement.html">CoreSliderElement</a></li><li><a href="CoreTooltipElement.html">CoreTooltipElement</a></li><li><a href="module-CoreElement-CoreElement.html">CoreElement</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.2</a> on Thu Jun 13 2019 18:17:43 GMT-0700 (Pacific Daylight Time)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>