zefirka/Warden.js

语言: JavaScript

git: https://github.com/zefirka/Warden.js

声明性事件驱动的开发库
Declarative event-driven development library
README.md (中文)

Warden.js

用于功能反应式事件驱动开发的小型声明性库。

概念

Warden.js提供了使事件驱动的应用程序开发变得简单和声明的工具。 Warden.js的一般概念,使组合,组合和解决并发事件更简单。在数学意义上,想要将应用程序的事件表示从状态树更改为部分有序的时间(或其他)优先级关系。

Warden.js不是纯函数库。它是纯粹的FRP和传统的事件驱动开发之间的权衡。它是现成事件驱动应用程序的理想解决方案。如果您不想考虑如何使用真正的功能实践构建应用程序从开始或/并且您已经拥有部分就绪的应用程序,那么您可以尝试使用Warden来让您轻松生活。

警告!突破0.3。*的变化。文档可能会弃用0.4。*

文档

  • 发布/订阅
  • 创建流
  • 使用流
  • 绑定数据
  • 反应计算

为什么选择Warden.js?

  • Warden.js中没有与DOM,jQuery或其他库或事件发射系统的依赖关系。您可以在正面和背面使用它。使用jQuery或Node的Event Emiter或没有任何东西。它很灵活。
  • 简单的声明方法,用于组合,结合和解析连接的事件。喜欢同步或解决。如果您的应用程序转向纠结的简单事件网络,并且您破坏了解决同步的时间,及时组合事件并解决问题 - 那么Warden.js就适合您。
  • 相当灵活的API。没有太多现成的解决方案,但有办法添加自己的数据流处理方法,组合方法和构建应用程序。
  • 它不是纯粹的功能,但保持简单。在Warden中,您可以创建具有脏状态的模块,但是如果您确定这些模块很简单且状态是可预测的。因此,您可以以更具声明性的方式组合和重用模块。在使用Warden开发时,不需要从头到尾使用纯函数式编程技术。
  • 它很轻巧。当前版本(0.4.0):15 KB(6 KB gzip压缩)。它还带有跨浏览器实用程序包。
  • 它是可配置的。您可以扩展流处理方法,创建自己的方法,配置数据类型和比较检查。
  • 低级功能抽象。你可以写一堆很酷的东西。事件采样器(例如)。

为什么不Warden.js?

  • 在非常大的和需求应用程序中使用它太早了。目前图书馆非常原始。没有社区,没有经验。如果您面向安全,高性能,流行的库或框架,请不要使用Warden.js。但是你可以帮助我们改善它!
  • 从FRP中实现F的弱点。如果您正在寻找纯粹功能性的现成解决方案 - 请查看Bacon,kefir,ProAct
  • 性能低下。在最佳使用中它比Bacon.js慢,但是如果你想保持纯粹的功能,你会发现Warden比Kefir,RxJS慢得多(有时它比Bacon.js慢一点)。
  • 低级功能抽象。您应该编写一堆代码来开发事件采样器(例如)。

安装和使用

节点

npm install warden.js

var Warden = require('warden.js');

浏览器

bower install warden.js

<script src="path/to/warden.js"></script>

有助于

我们总是很高兴新的拉动请求或问题。随意做出贡献。

本文使用googletrans自动翻译,仅供参考, 原文来自github.com

en_README.md

Warden.js Build Status

Small declarative library for event-driven development in functional reactive style.

Concept

Warden.js provides instruments to make development of event-driven applications easy and declarative. General idea of Warden.js that to make composing, combining and resolving concurrent events simpler. In mathematical sense, idea that to change your app's events representation from tree of states to the partially ordered set in time (or other) priority relation.

Warden.js is not pure functional library. It's trade-off between pure FRP and traditional event-driven development. It's good solution for ready event-driven applications. If you don't want to think how to construct app with true functional practices from start or/and you already have partially ready app then you can try Warden to make you life easy.

Warning! Breaking changes from 0.3.*. Documentation may be deprecated for 0.4.*

Documentation GitHub version

Why Warden.js?

  • There are no dependencies with DOM, jQuery or other libraries or event emitting system in the Warden.js. You can use it on the front and on the back. With jQuery or with Node's Event Emiter or without anything. It's flexible.
  • Simple declarative methods to combine, conjuncte and resolve concpetually connected events. Like sync or resolve. If your application turns to tangled web of simple events and you spoiling time to resolve synchronization, combining events in time and resolving problems - then Warden.js is for you.
  • Pretty flexible API. There are no much of ready solutions, but there is way to add your own data stream processing method, combine methods and construct application in your way.
  • It's not pure functional, but stay simple. In Warden you can create modules with dirty state, but if you're sure that these modules are simple and state is predictable. So after you can combine and reuse modules in more declarative way. It's not required to use pure functional programming technics from start to end while develop with Warden.
  • It's lighweight. Current version (0.4.0): 15 KB (6 KB gzipped). And it comes with crossbrowser utilities package.
  • It's configurable. You can extend stream processing methods, create your own methods, configure data types and comparsion checking.
  • Low-level functional abstraction. You can write a bunch of cool things. An events sampler (for example).

Why not Warden.js?

  • Too early to use it in really large and demandig applications. Currently library is pretty raw. No community, no experience. If you are orienting to the secure, high performance, popular library or framework don't use Warden.js. But you can help us make it better!
  • Weaky realization of F from FRP. If you are looking at ready solutions for pure functional in reactive way - check out Bacon, kefir, ProAct
  • Low performance. In optimal usage it's faset than Bacon.js, but if you want to stay pure functional you could find that Warden is much more slower than Kefir, RxJS (sometimes it's a bit of slower than Bacon.js).
  • Low-level functional abstraction. You should write a bunch of code to develop an events sampler (for example).

Installation and usage

Node npm version

npm install warden.js

and

var Warden = require('warden.js');

Browser

bower install warden.js

and

<script src="path/to/warden.js"></script>

Contribute

We're always glad to new pull requests or issues. Feel free to make contributions.