Archived
===
**This repository is archived**. Development migrated to https://github.com/RobotlegsJS/RobotlegsJS-Framework/blob/master/packages/signals.
SignalsJS
===
[![GitHub license](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobotlegsJS/SignalsJS/blob/master/LICENSE)
[![Gitter chat](https://badges.gitter.im/RobotlegsJS/RobotlegsJS.svg)](https://gitter.im/RobotlegsJS/RobotlegsJS)
[![npm version](https://badge.fury.io/js/%40robotlegsjs%2Fsignals.svg)](https://badge.fury.io/js/%40robotlegsjs%2Fsignals)
[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
**SignalsJS** is a [TypeScript](https://www.typescriptlang.org/) port of [AS3 Signals](https://github.com/robertpenner/as3-signals).
[15KB compressed](dist/signals.min.js).
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](https://github.com/robertpenner) in [AS3](https://github.com/robertpenner/as3-signals).
* **Signals** are inspired by [C# events](http://en.wikipedia.org/wiki/C_Sharp_syntax#Events) and [signals/slots](http://en.wikipedia.org/wiki/Signals_and_slots) in Qt.
Syntax
---
```typescript
// 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](https://www.npmjs.com/):
```bash
npm install @robotlegsjs/signals
```
Or using [Yarn](https://yarnpkg.com/en/):
```bash
yarn add @robotlegsjs/signals
```
Usage
---
```typescript
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](https://github.com/RobotlegsJS/SignalsJS) 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.](https://tidelift.com/subscription/pkg/npm-robotlegsjs-signals?utm_source=npm-robotlegsjs-signals&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
License
---
[MIT](LICENSE)
没有合适的资源?快使用搜索试试~ 我知道了~
AS3信号的TypeScript端口_TypeScript_JavaScript_下载.zip
共88个文件
ts:60个
md:9个
json:6个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 55 浏览量
2023-04-27
10:51:38
上传
评论
收藏 202KB ZIP 举报
温馨提示
AS3信号的TypeScript端口_TypeScript_JavaScript_下载.zip
资源推荐
资源详情
资源评论
收起资源包目录
AS3信号的TypeScript端口_TypeScript_JavaScript_下载.zip (88个子文件)
SignalsJS-master
.editorconfig 363B
yarn.lock 297KB
.vscode
settings.json 571B
extensions.json 52B
.eslintrc.js 6KB
tsconfig.test.json 150B
.prettierrc 439B
.github
ISSUE_TEMPLATE
custom.md 1KB
feature_request.md 560B
bug_report.md 799B
CONTRIBUTING.md 1KB
CODE_OF_CONDUCT.md 3KB
FUNDING.yml 37B
PULL_REQUEST_TEMPLATE.md 2KB
webpack.config.js 2KB
src
index.ts 1KB
org
osflash
signals
SlotList.ts 8KB
Signal.ts 1KB
IOnceSignal.ts 2KB
DeluxeSignal.ts 5KB
OnceSignal.ts 6KB
IPrioritySignal.ts 2KB
events
IBubbleEventHandler.ts 568B
IEvent.ts 827B
GenericEvent.ts 2KB
Promise.ts 1KB
PrioritySignal.ts 2KB
ISignal.ts 903B
Slot.ts 5KB
MonoSignal.ts 6KB
ISlot.ts 2KB
.istanbul.yml 942B
LICENSE 1KB
CHANGELOG.md 7KB
.auditignore 65B
dist
signals.min.js 15KB
package.json 4KB
karma.conf.js 2KB
test
mock
MockEvent.ts 308B
Sprite.ts 226B
MockMouseEvent.ts 294B
entry.ts 294B
util
TestBase.ts 894B
AsyncUtil.ts 780B
README.md 71B
index.ts 244B
org
osflash
signals
MonoSignalDispatchNoArgsTest.test.ts 1KB
DeluxeSignalWithBubblingEventTest.test.ts 3KB
SignalDispatchArgsTest.test.ts 2KB
PrioritySignalOnceTest.test.ts 6KB
SignalDispatchExtraArgsTest.test.ts 1KB
RedispatchedEventTest.test.ts 1KB
PromiseTest.test.ts 2KB
SignalWithCustomEventTest.test.ts 2KB
MonoSignalTest.test.ts 7KB
AmbiguousRelationshipTest.test.ts 1KB
GenericEventTest.test.ts 2KB
SignalDispatchVarArgsTest.test.ts 3KB
MonoSignalValueClassesTest.test.ts 3KB
MonoSignalDispatchNonEventTest.test.ts 2KB
SignalDispatchNoArgsTest.test.ts 1KB
SlotTest.test.ts 7KB
PriorityListenersTest.test.ts 3KB
SlotPauseResumeTest.test.ts 1KB
SignalTest.test.ts 3KB
DeluxeSignalValueClassesTest.test.ts 3KB
MonoSignalDispatchArgsTest.test.ts 2KB
PrioritySignalTest.test.ts 12KB
DeluxeSignalWithGenericEventTest.test.ts 5KB
SignalTestBase.test.ts 6KB
SignalDispatchNonEventTest.test.ts 2KB
support
Inherited2.ts 293B
Base.ts 224B
MessageEvent.ts 670B
Inherited1.ts 275B
BubbleHater.ts 555B
Child.ts 1KB
DeluxeSignalTargetTest.test.ts 1KB
MonoSignalSlotTest.test.ts 7KB
SlotTestBase.test.ts 14KB
MonoSignalDispatchExtraArgsTest.test.ts 1KB
SlotListTest.test.ts 8KB
MonoSignalDispatchVarArgsTest.test.ts 2KB
.gitignore 188B
tsconfig.json 542B
README.md 3KB
.mocharc.json 95B
.publishrc 313B
共 88 条
- 1
资源评论
快撑死的鱼
- 粉丝: 1w+
- 资源: 9156
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功