UNPKG

@polymer/polymer

Version:

The Polymer library makes it easy to create your own web components. Give your element some markup and properties, and then use it on a site. Polymer provides features like dynamic templates and data binding to reduce the amount of boilerplate you need to

51 lines (44 loc) 1.65 kB
<!-- @license Copyright (c) 2017 The Polymer Project Authors. All rights reserved. This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt --> <link rel="import" href="class.html"> <script> (function() { 'use strict'; /** * Legacy class factory and registration helper for defining Polymer * elements. * * This method is equivalent to * `customElements.define(info.is, Polymer.Class(info));` * * See `Polymer.Class` for details on valid legacy metadata format for `info`. * * @global * @override * @function Polymer * @param {!PolymerInit} info Object containing Polymer metadata and functions * to become class methods. * @return {function(new: HTMLElement)} Generated class * @suppress {duplicate, invalidCasts, checkTypes} */ window.Polymer._polymerFn = function(info) { // if input is a `class` (aka a function with a prototype), use the prototype // remember that the `constructor` will never be called let klass; if (typeof info === 'function') { klass = info; } else { klass = Polymer.Class(info); } customElements.define(klass.is, /** @type {!HTMLElement} */(klass)); return klass; }; })(); </script>