2.0.0 • Published 2 years ago

@poool/junipero-hooks v2.0.0

Weekly downloads
72
License
MIT
Repository
github
Last release
2 years ago

junipero

npm

Installation

yarn add @poool/junipero-hooks

Usage

import React from 'react';
import { useEventListener, useTimeout } from '@poool/junipero-hooks';

export default () => {
  useTimeout(() => {
    console.log('This has been executed 1s after first render!');
  }, 1000);

  useEventListener('click', () => {
    console.log('You clicked inside the current document');
  });

  return <div />;
};

Documentation

useEventListener(name: String, handler: Function, target: DOMNode)

  • name {String} Event name
  • handler {Function}
    • event {Object} Event data
  • target {DOMNode} Custom event target (default: global)

useTimeout(handler: Function, time: Number, changes: Array)

  • handler {Function} Timeout callback
  • time {Number} Time in ms before timeout
  • changes {Array} Reset timer when any value changes (just like useEffect)

Contributing

Please check the CONTRIBUTING.md doc for contribution guidelines.

License

This software is licensed under MIT.

2.0.0

2 years ago

2.0.0-rc.22

3 years ago

2.0.0-rc.19

3 years ago

2.0.0-rc.20

3 years ago

2.0.0-rc.21

3 years ago

2.0.0-rc.16

3 years ago

2.0.0-rc.15

4 years ago

2.0.0-rc.14

4 years ago

2.0.0-rc.13

4 years ago

2.0.0-rc.10

4 years ago

2.0.0-rc.9

4 years ago

2.0.0-rc.5

4 years ago

2.0.0-rc.0

4 years ago

2.0.0-beta.28

4 years ago

2.0.0-beta.7

4 years ago

2.0.0-beta.3

4 years ago

2.0.0-beta.0

4 years ago

2.0.0-alpha.23

4 years ago

2.0.0-alpha.22

4 years ago

2.0.0-alpha.20

4 years ago

2.0.0-alpha.15

4 years ago

2.0.0-alpha.11

4 years ago

2.0.0-alpha.10

4 years ago

2.0.0-alpha.12

4 years ago

2.0.0-alpha.8

5 years ago

2.0.0-alpha.7

5 years ago

2.0.0-alpha.6

5 years ago

2.0.0-alpha.5

5 years ago

2.0.0-alpha.4

5 years ago

2.0.0-alpha.0

5 years ago