Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 951B

1234567891011121314151617181920212223242526272829303132333435363738
  1. # defer-to-connect
  2. > The safe way to handle the `connect` socket event
  3. [![Coverage Status](https://coveralls.io/repos/github/szmarczak/defer-to-connect/badge.svg?branch=master)](https://coveralls.io/github/szmarczak/defer-to-connect?branch=master)
  4. Once you receive the socket, it may be already connected (or disconnected).<br>
  5. To avoid checking that, use `defer-to-connect`. It'll do that for you.
  6. ## Usage
  7. ```js
  8. const deferToConnect = require('defer-to-connect');
  9. deferToConnect(socket, () => {
  10. console.log('Connected!');
  11. });
  12. ```
  13. ## API
  14. ### deferToConnect(socket, connectListener)
  15. Calls `connectListener()` when connected.
  16. ### deferToConnect(socket, listeners)
  17. #### listeners
  18. An object representing `connect`, `secureConnect` and `close` properties.
  19. Calls `connect()` when the socket is connected.<br>
  20. Calls `secureConnect()` when the socket is securely connected.<br>
  21. Calls `close()` when the socket is destroyed.
  22. ## License
  23. MIT