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

50 lines (44 loc) 1.42 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 */ /** * Total number of Polymer element instances created. * @type {number} */ export let instanceCount = 0; export function incrementInstanceCount() { instanceCount++; } /** * Array of Polymer element classes that have been finalized. * @type {!Array<!PolymerElementConstructor>} */ export const registrations = []; /** * @param {!PolymerElementConstructor} prototype Element prototype to log * @private */ function _regLog(prototype) { console.log('[' + /** @type {?} */(prototype).is + ']: registered'); } /** * Registers a class prototype for telemetry purposes. * @param {!PolymerElementConstructor} prototype Element prototype to register * @protected */ export function register(prototype) { registrations.push(prototype); } /** * Logs all elements registered with an `is` to the console. * @public */ export function dumpRegistrations() { registrations.forEach(_regLog); }