Giter Site home page Giter Site logo

rontian / signalsjs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from robotlegsjs/signalsjs

0.0 0.0 0.0 6.11 MB

TypeScript port of AS3 Signals

Home Page: https://www.npmjs.com/package/@robotlegsjs/signals

License: MIT License

JavaScript 2.19% TypeScript 97.81%

signalsjs's Introduction

SignalsJS

GitHub license Gitter chat Build Status codebeat badge Maintainability Test Coverage npm version Greenkeeper badge styled with prettier

SignalsJS is a TypeScript port of AS3 Signals. 15KB compressed.

About

Signals are light-weight, strongly-typed messaging tools. Wire your application with better APIs and less boilerplate than normal event systems.

Concept

  • A Signal is essentially a mini-dispatcher specific to one event, with its own array of listeners.
  • A Signal gives an event a concrete membership in a class.
  • Listeners subscribe to real objects, not to string-based channels.
  • Event string constants are no longer needed.
  • Signals was originally implemented by Robert Penner in AS3.
  • Signals are inspired by C# events and signals/slots in Qt.

Syntax

// with DOM EventListener
button.addEventListener("click", onClick);

// Signal equivalent; past tense is recommended
button.clicked.add(onClicked);

Installation

You can get the latest release and the type definitions using NPM:

npm install @robotlegsjs/signals

Or using Yarn:

yarn add @robotlegsjs/signals

Usage

import { Signal } from "@robotlegsjs/signals";

let signal = new Signal();

signal.add(data => {
    console.log(data.message);
});

signal.dispatch({ message: "hello signal!" });

SignalsJS for enterprise

Available as part of the Tidelift Subscription

The maintainers of @robotlegsjs/signals and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. Learn more.

License

MIT

signalsjs's People

Contributors

bartosz-oczujda avatar dependabot[bot] avatar endel avatar greenkeeper[bot] avatar greenkeeperio-bot avatar k3muri84 avatar tiagoschenkel avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.