Skip to content
generated from stagas/ts

custom elements base class factory with properties mapped to observed attributes

Notifications You must be signed in to change notification settings

stagas/with-properties

Repository files navigation

with-properties

custom elements base class factory with properties mapped to observed attributes

🔧 Install · 🧩 Example · 📜 API docs · 🔥 Releases · 💪🏼 Contribute · 🖐️ Help


Install

$ npm i with-properties

API

Table of Contents

withProperties

src/index.ts:84-129

class Foo extends withProperties(
  HTMLElement,
  class {
    string? = String
    number? = Number
    boolean = Boolean
    implicitString = 'string'
    implicitNumber = 123
    implicitBoolean = true
    somethingElse? = new Uint8Array(1)
  }
) {}

Parameters

  • parent C The parent constructor to extend (usually HTMLElement)
  • propsClass Constructor<P> A "props" class to create the properties from

Returns any A base constructor to be extended from

Contribute

Fork or edit and submit a PR.

All contributions are welcome!

License

MIT © 2021 stagas