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

@polymer/polymer

Package Overview
Dependencies
Maintainers
2
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

  • 2.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
130K
increased by8.69%
Maintainers
2
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 19 Sep 2017

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