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

ember-events-modifier

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-events-modifier

eventing modifiers

  • 0.6.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

ember-events-modifier

NPM Build Status Ember Observer Score Ember Version Download count Code Climate Test Coverage

Installation

ember install ember-events-modifier

Demo

Demo

Usage

The addon provides an events service which can be used to facilitate events throughout your application. You can use the service directly, without using the modifiers, described below.

import Controller from "@ember/controller";
import { action } from "@ember/object";
import { inject as service } from "@ember/service";

export default class MyController extends Controller {
    @service events;

    @action clickedBook(book) {
        this.events.trigger(`book:active:${book.id}`, book);
    }
}

on-event

The on-event modifier allows you to register a handler for specific events.

Your action handler will be passed arguments that are provided when the action is triggered.

Note that the handler is automatically registered and removed on insertion/removal, respectively.

<div {{on-event "blog-updated" this.reloadBlog}}>
    ...
</div>

You can also handle multiple events with one declaration:

<div {{on-event (array "blog-updated" "blog-created") this.reloadBlog}}>
    ...
</div>

trigger-event

The trigger-event modifier allows you to trigger an event when the element is inserted.

{{#if this.showDetails}}
    <div {{trigger-event (concat "book:showing-details:" @book.id) @book}}>
        ...
    </div>
{{/if}}

Compatibility

  • Ember.js v3.28 or above
  • Ember CLI v3.28 or above
  • Node.js v14 or above

Contributing

See the Contributing guide for details.

License

This project is licensed under the MIT License.

Keywords

FAQs

Package last updated on 28 Mar 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