Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@project-nos/decorators

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@project-nos/decorators

Project NOS decorators is a library to help you develop spryker frontend components fast and easy.

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

NOS decorators

NOS decorators

github workflow tests mit license npm npm bundle size

A library to help you build Web Components fast and easy.

You no longer have to write all the boilerplate code needed to bring your components to life. Under the hood this library uses decorators to automatically bind attributes, actions and targets to your Web Components.

There is no better way to get a feel for what NOS decorators is and what it can do, than by seeing it for yourself:

Imagine you create a hello-world component which generates following html:

<hello-world some-number="123" some-boolean some-string="baz" some-array="[4,5,6]" some-object="{"foo":"bar"}">
  <button hello-world-action="click#foo" hello-world-target="bar"></button>
  <div hello-world-targets="bazs">...</div>
  <div hello-world-targets="bazs">...</div>
</hello-world>

You no longer need to query for elements on your own, listen for events or create getters for attributes. Everything you have to do is to add the corresponding decorators to your class and properties.

import { actionable, attributable, attribute, targetable, target, targets } from '@project-nos/decorators';

@actionable()
@attributable()
@targetable()
class HelloWorld extends HTMLElement {
    @attribute({ type: Number })
    accessor someNumber: number

    @attribute({ type: Boolean })
    accessor someBoolean: boolean;

    @attribute({ type: String })
    accessor someString: string;

    @attribute({ type: Array })
    accessor someArray: [];

    @attribute({ type: Object })
    accessor someObject: object;

    @target()
    accessor bar: HTMLButtonElement;

    @targets()
    accessor bazs: HTMLDivElement[];
    
    foo(event: Event) {
        //...
    }
}

Documentation

For full documentation, visit our Wiki.

License

Copyright (c) Andreas Penz. Licensed unter the MIT License.

Keywords

FAQs

Package last updated on 27 Nov 2023

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