Web 组件规范功能抽象 SkateJS

码农软件 · 软件分类 · 网页组件 · 2019-04-08 12:28:05

软件介绍

SkateJS 是一个 Web 组件库,旨在提供扩充 Web 组件规范能力,它重点关注功能渲染管道、清理 attribute/property 语义和较小的占用空间。

抽象能力包括:

  • 生成跨框架兼容组件。

  • 通过 props 或原生类型,抽象出常见的 attribute/property 语义,例如属性 reflection 和 coercion。

  • 添加一些生命周期回调以响应 prop 更新、渲染,以及管理内部组件状态的方法。

  • 提供一组基本的 mixin,它们 hook 渲染器,如 @skatejs/renderer-preact

使用 Skate 与 Preact 可以这样写 Web 组件:

// @jsx h

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

class WithPreact extends withComponent(withPreact()) {
  static get props() {
    return {
      name: props.string // String could be used also to define the prop type
    };
  }
  render({ name }) {
    return <span>Hello, {name}!</span>;
  }
}

customElements.define('with-preact', WithPreact);

本文地址:https://codercto.com/soft/d/3126.html

Design for Hackers

Design for Hackers

David Kadavy / Wiley / 2011-10-18 / USD 39.99

Discover the techniques behind beautiful design?by deconstructing designs to understand them The term ?hacker? has been redefined to consist of anyone who has an insatiable curiosity as to how thin......一起来看看 《Design for Hackers》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码