
Company News
/Security News
Socket Selected for OpenAI's Cybersecurity Grant Program
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.
@rhtml/decorators
Advanced tools
npm i @rhtml/decorators
import { Attribute, Options, Input } from '@rhtml/custom-attributes';
import { HostListener } from '@rhtml/decorators';
@Modifier({
selector: 'test',
})
export class TestDirective extends Attribute {
@Input()
myProperty: string;
@HostListener('mouseenter')
enter(event: Event) {
console.log('ENTER', this, event);
console.log(this.myProperty);
}
@HostListener('mouseleave')
leave(event: Event) {
console.log('LEAVE', this, event);
console.log(this.myProperty);
}
}
<div test myProperty="12312">111</div>
import { Component, html, LitElement } from '@rxdi/lit-html';
import { HostListener } from '@rhtml/decorators';
/**
* @customElement home-component
*/
@Component({
selector: 'home-component',
template(this) {
return html` Home Component `;
},
})
export class HomeComponent extends LitElement {
@HostListener('mouseenter') onEnter() {
console.log('Enter home');
}
@HostListener('mouseleave') onLeave() {
console.log('Leave home');
}
}
import { Component, html, LitElement } from '@rxdi/lit-html';
import { HostListener } from '@rhtml/decorators';
/**
* @customElement home-component
*/
@Component({
selector: 'home-component',
template(this) {
return html` Home Component `;
},
})
export class HomeComponent extends LitElement {
@HostListener('window:mouseenter')
onEnter() {
console.log('Enter home');
}
@HostListener('window:mouseleave')
onLeave() {
console.log('Leave home');
}
}
Specifiyng Input and HostBinding decorator gives you an reactive ability to assign styles directly to input properties
This way by editing padding, color or background will reflect to the style associated with
By doing this we can skip OnInit, OnDestroy, OnUpdate manual assign inside hooks
import { Attribute, Input, Modifier } from '@rhtml/custom-attributes';
import { HostBinding } from '@rhtml/decorators';
@Modifier({
selector: 'layout',
})
export class CustomLayout extends Attribute {
@Input({ observe: true })
@HostBinding('style.padding')
padding: string;
@Input({ observe: true })
@HostBinding('style.color')
color: string;
@Input({ observe: true })
@HostBinding('style.background')
background: string;
}
FAQs
Reactive HyperText Markup Language
The npm package @rhtml/decorators receives a total of 51 weekly downloads. As such, @rhtml/decorators popularity was classified as not popular.
We found that @rhtml/decorators demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.

Security News
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.

Research
/Security News
Campaign of 108 extensions harvests identities, steals sessions, and adds backdoors to browsers, all tied to the same C2 infrastructure.