Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More ā†’
Socket
Sign inDemoInstall
Socket

@polymer/polymer

Package Overview
Dependencies
Maintainers
12
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@polymer/polymer

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

  • 3.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
104K
decreased by-12.28%
Maintainers
12
Weekly downloads
Ā 
Created

What is @polymer/polymer?

@polymer/polymer is a library for building web components using the Polymer framework. It provides a set of features to create reusable, encapsulated HTML elements with custom behavior.

What are @polymer/polymer's main functionalities?

Define a Custom Element

This feature allows you to define a custom HTML element with specific properties and behaviors. The example shows how to create a custom element named 'my-element' with a property 'myProperty'.

class MyElement extends Polymer.Element {
  static get is() { return 'my-element'; }
  static get properties() {
    return {
      myProperty: {
        type: String,
        value: 'default value'
      }
    };
  }
}
customElements.define(MyElement.is, MyElement);

Data Binding

This feature allows you to bind data to your custom element's template. The example shows how to bind the 'myProperty' value to a div inside the custom element's template.

<dom-module id="my-element">
  <template>
    <div>{{myProperty}}</div>
  </template>
  <script>
    class MyElement extends Polymer.Element {
      static get is() { return 'my-element'; }
      static get properties() {
        return {
          myProperty: {
            type: String,
            value: 'default value'
          }
        };
      }
    }
    customElements.define(MyElement.is, MyElement);
  </script>
</dom-module>

Event Handling

This feature allows you to handle events within your custom element. The example shows how to handle a click event on a button inside the custom element's template.

<dom-module id="my-element">
  <template>
    <button on-click="handleClick">Click me</button>
  </template>
  <script>
    class MyElement extends Polymer.Element {
      static get is() { return 'my-element'; }
      handleClick() {
        console.log('Button clicked');
      }
    }
    customElements.define(MyElement.is, MyElement);
  </script>
</dom-module>

Other packages similar to @polymer/polymer

FAQs

Package last updated on 21 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with āš”ļø by Socket Inc