Search Tutorials

Top Polymer JS (2024) Framework frequently asked interview questions | JavaInUse

Polymer Framework Interview Questions

In this post we will look at Polymer Framework Interview questions. Examples are provided with explanation.

Q: What is Polymer Framework?
Polymer.js is a JavaScript library created by Google that allows reusing the HTML elements for building applications with components. Polymer is an open-source JavaScript library developed by Google developers and was initially released on May 27, 2015.

Q: What are the advantages of using Polymer Framework?
The Advantages of using Polymer are as follows-
  • It allows users to create their own custom elements easily using the HTML, CSS, and JavaScript for adding interactions to the element.
  • Provides cross-browser compatibility long with web components.
  • Polymer command line interface helps managing complex projects
  • Provides both one-way and two way binding.
Q: What elements of Polymer Framework have you used?
Polymer contains a few primary collections of elements:
  • Iron elements. A set of utility elements including generic UI elements (such as icons, input and layout components), as well as non-UI elements providing features like AJAX, signaling and storage.
  • Paper elements. A set of UI elements that implement the material design system.
  • Gold elements. Form elements for ecommerce.
  • Neon elements. Animation-related elements.
  • Platinum elements. Elements for app-like features, like push notifications, offline caching and bluetooth.

Q: How to create custom elements using Polymer Framework?
Custom elements provide a component model for the web. The custom elements specification provides:
  • A mechanism for associating a class with a custom element name.
  • A set of lifecycle callbacks invoked when an instance of the custom element changes state (for example, added or removed from the document).
  • A callback invoked whenever one of a specified set of attributes changes on the instance.

To define a custom element, you create an ES6 class and associate it with the custom element name. For the full set of Polymer features, extend the Polymer.Element class:
<link rel="import" href="/bower_components/polymer/polymer-element.html">

  class MyPolymerElement extends Polymer.Element {

  customElements.define('my-polymer-element', MyPolymerElement);
Q: Define the custom element lifecycle?
The custom element spec provides a set of callbacks called "custom element reactions" that allow you to run user code in response to certain lifecycle changes.
Reaction Description
constructor Called when the element is upgraded (that is, when an element is created, or when a previously-created element becomes defined).
connectedCallback Called when the element is added to a document.
disconnectedCallback Called when the element is removed from a document.
attributeChangedCallback Called when any of the element's attributes are changed, appended, removed, or replaced,

See Also

Spring Batch Interview Questions Apache Camel Interview Questions JBoss Fuse Interview Questions Drools Interview Questions Java 8 Interview Questions