Socket
Socket
Sign inDemoInstall

skatejs

Package Overview
Dependencies
Maintainers
8
Versions
151
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

skatejs

Skate is a library built on top of the W3C web component specs that enables you to write functional and performant web components with a very small footprint.


Version published
Weekly downloads
3.1K
decreased by-10.07%
Maintainers
8
Weekly downloads
 
Created
Source

Skate

Downloads per month NPM version Build Status Join the chat at https://gitter.im/skatejs/skatejs Commitizen friendly Semantic Release OpenCollective OpenCollective Follow @skate_js on Twitter

Sauce Test Status

Skate is high level, functional abstraction over the web component specs that:

  • Produces cross-framework compatible components
  • Abstracts away common attribute / property semantics via props, such as attribute reflection and coercion
  • Adds several lifecycle callbacks for responding to prop updates, rendering and more
  • Provides a base set of mixins that hook into renderers such as @skatejs/renderer-preact.

Installing

npm install skatejs

To use Skate with a renderer, you'll want to install one of them:

npm install skatejs @skatejs/renderer-[renderer]

Where [renderer] is one of:

Basic usage

HTML

<x-hello name="Bob"></x-hello>

JavaScript (using the Preact renderer)

/** @jsx h */

import { props, withComponent } from 'skatejs';
import withPreact from '@skatejs/renderer-preact';
import { h } from 'preact';

const Component = withComponent(withPreact());

customElements.define('x-hello', class extends Component {
  static props = {
    name: props.string
  }
  renderCallback ({ name }) {
    return <span>Hello, {name}!</span>;
  }
});

Result

<x-hello name="Bob">
  #shadow-root
    <span>Hello, Bob!</span>
</x-hello>

Whenever you change the name property - or attribute - the component will re-render, only changing the part of the DOM that requires updating.

Polyfills

Skate uses both Custom Elements and Shadow DOM, but is capable of operating without Shadow DOM, you just don't get any encapsulation.

For more information on the polyfills, see their docs.

Browser Support

Skate supports all evergreens and IE11, and is subject to the browser support matrix of the polyfills.

Backers

Support us with a monthly donation and help us continue our activities. [Become a backer]

Sponsors

Become a sponsor and get your logo on our README on Github with a link to your site. [Become a sponsor]

Keywords

FAQs

Package last updated on 20 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