EE First——模具行业从业者必备知识手册
-
<h2>EE First</h2>
<p>[![NPM version][npm-image]][npm-url]</p>
<p>[![Build status][travis-image]][travis-url]</p>
<p>[![Test coverage][coveralls-image]][coveralls-url]</p>
<p>[![License][license-image]][license-url]</p>
<p>[![Downloads][downloads-image]][downloads-url]</p>
<p>[![Gittip][gittip-image]][gittip-url]</p><p>Get the first event in a set of event emitters and event pairs,</p>
<p>then clean up after itself.</p><h3>Install</h3>
<pre><code>
$ npm install ee-first
</code></pre><h3>API</h3>
<pre><code>
var first = require('ee-first')
</code></pre><h4>first(arr, listener)</h4>
<p>Invoke <code>listener</code> on the first event from the list specified in <code>arr</code>. <code>arr</code> is</p>
<p>an array of arrays, with each array in the format <code>[ee, ...event]</code>. <code>listener</code></p>
<p>will be called only once, the first time any of the given events are emitted. If</p>
<p><code>error</code> is one of the listened events, then if that fires first, the <code>listener</code></p>
<p>will be given the <code>err</code> argument.</p><p>The <code>listener</code> is invoked as <code>listener(err, ee, event, args)</code>, where <code>err</code> is the</p>
<p>first argument emitted from an <code>error</code> event, if applicable; <code>ee</code> is the event</p>
<p>emitter that fired; <code>event</code> is the string event name that fired; and <code>args</code> is an</p>
<p>array of the arguments that were emitted on the event.</p><pre><code>
var ee1 = new EventEmitter()
var ee2 = new EventEmitter()first([
[ee1, 'close', 'end', 'error'],
[ee2, 'error']
], function (err, ee, event, args) {
// listener invoked
})
</code></pre><p>#### .cancel()</p>
<p>The group of listeners can be cancelled before being invoked and have all the event</p>
<p>listeners removed from the underlying event emitters.</p><pre><code>
var thunk = first([
[ee1, 'close', 'end', 'error'],
[ee2, 'error']
], function (err, ee, event, args) {
// listener invoked
})// cancel and clean up
thunk.cancel()
</code></pre><p>[npm-image]: https://img.shields.io/npm/v/ee-first.svg?style=flat-square</p>
<p>[npm-url]: https://npmjs.org/package/ee-first</p>
<p>[github-tag]: http://img.shields.io/github/tag/jonathanong/ee-first.svg?style=flat-square</p>
<p>[github-url]: https://github.com/jonathanong/ee-first/tags</p>
<p>[travis-image]: https://img.shields.io/travis/jonathanong/ee-first.svg?style=flat-square</p>
<p>[travis-url]: https://travis-ci.org/jonathanong/ee-first</p>
<p>[coveralls-image]: https://img.shields.io/coveralls/jonathanong/ee-first.svg?style=flat-square</p>
<p>[coveralls-url]: https://coveralls.io/r/jonathanong/ee-first?branch=master</p>
<p>[license-image]: http://img.shields.io/npm/l/ee-first.svg?style=flat-square</p>
<p>[license-url]: LICENSE.md</p>
<p>[downloads-image]: http://img.shields.io/npm/dm/ee-first.svg?style=flat-square</p>
<p>[downloads-url]: https://npmjs.org/package/ee-first</p>
<p>[gittip-image]: https://img.shields.io/gittip/jonathanong.svg?style=flat-square</p>
<p>[gittip-url]: https://www.gittip.com/jonathanong/</p><hr>
<p>本文由模极社发布</p>
<h4>
内容概览</h4><table>
<tr><td>分类</td><td>要点</td><td>建议/说明</td></tr>
<tr><td>核心概念</td><td>EE First</td><td>详见正文</td></tr>
<tr><td>操作步骤</td><td>EE First</td><td>详见正文</td></tr>
<tr><td>注意事项</td><td>EE First</td><td>详见正文</td></tr>
<tr><td>适用场景</td><td>EE First</td><td>详见正文</td></tr>
<tr><td>常见问题</td><td>EE First</td><td>详见正文</td></tr>
</table><hr>
<h4>
你可能还感兴趣</h4>
<ul>
<li><a href="/t/4239/4239">传递模塑成型(RTM):工艺原理、分类与应用领域</a></li>
<li><a href="/t/3617/3617">震界自动化压铸输送带</a></li>
<li><a href="/t/4318/4318">deepmerge</a></li>
</ul><hr>
<p><strong>相关推荐:</strong></p>
<ul>
<li><a href="https://www.mj7.cn/t/4836-4836">北京模具产业 — 科技研发驱动型模具基地</a></li>
<li><a href="https://www.mj7.cn/t/4835-4835">上海模具产业 — 高端精密模具研发中心</a></li>
<li><a href="https://www.mj7.cn/t/4834-4834">产业集群与模具产业发展的关系</a></li>
</ul><hr>
<p>踩过坑的来评论区说说。</p>