🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

eventualize

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eventualize

A JavaScript microlibrary for automatic event binding

latest
Source
npmnpm
Version
0.2.0
Version published
Maintainers
2
Created
Source

Eventualize

convention-based automatic event binding for EventEmitters in your object-oriented JavaScript code

Circle CI Dependency Status devDependency Status

class Stream

  constructor: ->
    @socket = new Socket()

    # This call wires up all properly named event listeners in this class.
    # It is equivalent to running:
    # @socket.on 'open', @onSocketOpen
    # @socket.on 'data', @onSocketData
    # @socket.on 'error', @onSocketError
    eventualize this


  @onSocketOpen = (err, handle) -> ...
  @onSocketData = (err, data) -> ...
  @onSocketError = (err, message) -> ...

This also works for jQuery event emitters in the browser:

class ConfirmDialog

  constructor: ->
    @confirmButton = $('#confirm')
    @cancelButton = $('#cancel')

    # This call is equivalent to
    # @confirmButton.on 'click', @onConfirmButtonClick
    # @cancelButton.on 'click', @onCancelButtonClick
    # @cancelButton.on 'hover', @onCancelButtonHover
    eventualize this

  @onConfirmButtonClick: -> ...
  @onCancelButtonClick: -> ...
  @onCancelButtonHover: -> ...

Development

See the developer guidelines

FAQs

Package last updated on 29 Feb 2016

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