- App.tsx: full navigation (Auth stack + Main tabs with 5 screens) - Auth: LoginScreen, RegisterScreen, ForgotPasswordScreen - HomeScreen: dashboard with IoT metrics, weather widget, alerts, quick actions, sensors - MapScreen: interactive map with layer toggles (6 layers) - MarketplaceScreen: categories (6), products (5), search - ChatScreen: AI chat with quick prompts (4), bot responses - ProfileScreen: user info, stats, menu (9 items), logout - AlertsScreen: alert list with severity, acknowledge - SensorsScreen: sensor list with type filters (6 types), search - ZonesScreen: zone cards with stats - SettingsScreen: language picker (FR/EN/ES/DE), privacy, about - Stores: iotStore (sensors, zones, alerts), notificationStore, uiStore + i18n - Hooks: useSensors, useAlerts, useNotifications, useLocation - Components: Card, Button, LoadingSpinner, ErrorBoundary, Header - Services: iotService, notificationService (with axios API client) - Utils: formatters (temp, AQI, noise, dates), validators (email, password, IBAN) - Theme: colors.ts with full design system (Blue Ocean palette) - Ditto: fixed MongoDB connection, new JWT secrets, official gateway image
81 lines
2.6 KiB
Markdown
81 lines
2.6 KiB
Markdown
# EE First
|
|
|
|
[![NPM version][npm-image]][npm-url]
|
|
[![Build status][travis-image]][travis-url]
|
|
[![Test coverage][coveralls-image]][coveralls-url]
|
|
[![License][license-image]][license-url]
|
|
[![Downloads][downloads-image]][downloads-url]
|
|
[![Gittip][gittip-image]][gittip-url]
|
|
|
|
Get the first event in a set of event emitters and event pairs,
|
|
then clean up after itself.
|
|
|
|
## Install
|
|
|
|
```sh
|
|
$ npm install ee-first
|
|
```
|
|
|
|
## API
|
|
|
|
```js
|
|
var first = require('ee-first')
|
|
```
|
|
|
|
### first(arr, listener)
|
|
|
|
Invoke `listener` on the first event from the list specified in `arr`. `arr` is
|
|
an array of arrays, with each array in the format `[ee, ...event]`. `listener`
|
|
will be called only once, the first time any of the given events are emitted. If
|
|
`error` is one of the listened events, then if that fires first, the `listener`
|
|
will be given the `err` argument.
|
|
|
|
The `listener` is invoked as `listener(err, ee, event, args)`, where `err` is the
|
|
first argument emitted from an `error` event, if applicable; `ee` is the event
|
|
emitter that fired; `event` is the string event name that fired; and `args` is an
|
|
array of the arguments that were emitted on the event.
|
|
|
|
```js
|
|
var ee1 = new EventEmitter()
|
|
var ee2 = new EventEmitter()
|
|
|
|
first([
|
|
[ee1, 'close', 'end', 'error'],
|
|
[ee2, 'error']
|
|
], function (err, ee, event, args) {
|
|
// listener invoked
|
|
})
|
|
```
|
|
|
|
#### .cancel()
|
|
|
|
The group of listeners can be cancelled before being invoked and have all the event
|
|
listeners removed from the underlying event emitters.
|
|
|
|
```js
|
|
var thunk = first([
|
|
[ee1, 'close', 'end', 'error'],
|
|
[ee2, 'error']
|
|
], function (err, ee, event, args) {
|
|
// listener invoked
|
|
})
|
|
|
|
// cancel and clean up
|
|
thunk.cancel()
|
|
```
|
|
|
|
[npm-image]: https://img.shields.io/npm/v/ee-first.svg?style=flat-square
|
|
[npm-url]: https://npmjs.org/package/ee-first
|
|
[github-tag]: http://img.shields.io/github/tag/jonathanong/ee-first.svg?style=flat-square
|
|
[github-url]: https://github.com/jonathanong/ee-first/tags
|
|
[travis-image]: https://img.shields.io/travis/jonathanong/ee-first.svg?style=flat-square
|
|
[travis-url]: https://travis-ci.org/jonathanong/ee-first
|
|
[coveralls-image]: https://img.shields.io/coveralls/jonathanong/ee-first.svg?style=flat-square
|
|
[coveralls-url]: https://coveralls.io/r/jonathanong/ee-first?branch=master
|
|
[license-image]: http://img.shields.io/npm/l/ee-first.svg?style=flat-square
|
|
[license-url]: LICENSE.md
|
|
[downloads-image]: http://img.shields.io/npm/dm/ee-first.svg?style=flat-square
|
|
[downloads-url]: https://npmjs.org/package/ee-first
|
|
[gittip-image]: https://img.shields.io/gittip/jonathanong.svg?style=flat-square
|
|
[gittip-url]: https://www.gittip.com/jonathanong/
|