Socket
Socket
Sign inDemoInstall

eventualize

Package Overview
Dependencies
4
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    eventualize

A JavaScript microlibrary for automatic event binding


Version published
Weekly downloads
11
Maintainers
2
Install size
105 kB
Created
Weekly downloads
 

Readme

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

Last updated on 29 Feb 2016

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc