Skip to content
This repository has been archived by the owner on Jul 16, 2020. It is now read-only.

Releases: ar2r13/Custom.Element

v0.4

18 May 14:20
Compare
Choose a tag to compare

0.4

New text-stamps syntax

Old (v0.3.3):
<template>
  [[::this.greeting]]
</template>

<script>
class MyComponent extends Custom.element {
  static get observedProperties() {
    return ['greeting', 'userName']
  }
  // ...
  set userName(value) {
    this.greeting = value.trim() 
      ? 'Hello, ' + value
      : ''
  }
}
// ...
</script>
New (v0.4):
<template>
  ((this.userName ? 'Hello, ' + this.userName : ''))
</template>

(...)

  • You can run expression code here
  • Became faster
  • Handling all errors without blocking thread

Changes in attribute binding API

Old (v0.3.3):
<input type="text" value="::this.userName" oninput="::this.userName = this.value">
New (v0.4):
<input type="text" ::value="this.userName" oninput="this.userName = value">

Computable attributes

In v0.3 all attributes which contains '::this', automaticaly runs value like expressions.
In v0.4 to make the attribute computable, need add :: prefix to attribute name.