{"id":15313870,"url":"https://github.com/itsdouges/react-debounce-decorator","last_synced_at":"2026-01-06T19:05:02.719Z","repository":{"id":71499353,"uuid":"87858358","full_name":"itsdouges/react-debounce-decorator","owner":"itsdouges","description":"⛹ Useful for debouncing tooltips or anything you want to happen immediately, and be called back after a while.","archived":false,"fork":false,"pushed_at":"2017-05-07T02:22:50.000Z","size":3086,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-24T15:43:50.645Z","etag":null,"topics":["debounce","decorator","gw2armory","higher-order-component","hoc","javascript","react","reactjs","redux","tooltip"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/itsdouges.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-04-10T21:15:19.000Z","updated_at":"2025-02-11T15:49:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"7c4af92c-e5f5-4400-8f1b-fe098d10b5cb","html_url":"https://github.com/itsdouges/react-debounce-decorator","commit_stats":{"total_commits":16,"total_committers":1,"mean_commits":16.0,"dds":0.0,"last_synced_commit":"0bc7c6364a81003d5733243dba426e38dfb98878"},"previous_names":["madou/react-debounce-decorator"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsdouges%2Freact-debounce-decorator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsdouges%2Freact-debounce-decorator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsdouges%2Freact-debounce-decorator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsdouges%2Freact-debounce-decorator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/itsdouges","download_url":"https://codeload.github.com/itsdouges/react-debounce-decorator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245404127,"owners_count":20609653,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["debounce","decorator","gw2armory","higher-order-component","hoc","javascript","react","reactjs","redux","tooltip"],"created_at":"2024-10-01T08:43:29.260Z","updated_at":"2026-01-06T19:05:02.675Z","avatar_url":"https://github.com/itsdouges.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [react-debounce-decorator](https://github.com/madou/react-debounce-decorator)\n\n[![NPM version](http://img.shields.io/npm/v/react-debounce-decorator.svg?style=flat-square)](https://www.npmjs.com/package/react-debounce-decorator)\n[![NPM downloads](http://img.shields.io/npm/dm/react-debounce-decorator.svg?style=flat-square)](https://www.npmjs.com/package/react-debounce-decorator)\n[![Build Status](http://img.shields.io/travis/madou/react-debounce-decorator/master.svg?style=flat-square)](https://travis-ci.org/madou/react-debounce-decorator)\n[![codecov](https://codecov.io/gh/madou/react-debounce-decorator/branch/master/graph/badge.svg)](https://codecov.io/gh/madou/react-debounce-decorator)\n[![Dependency Status](http://img.shields.io/david/madou/react-debounce-decorator.svg?style=flat-square)](https://david-dm.org/madou/react-debounce-decorator)\n\nInjects `hide` and `show` props into a wrapped component. Currently being used in [Guild Wars 2 Armory](https://gw2armory.com) for tooltip debouncing.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/madou/react-debounce-decorator/blob/master/example.gif?raw=true\u0026cb=1\" style=\"margin:0 auto\" /\u003e\n\u003c/p\u003e\n\n## Installation\n\n```sh\nnpm install react-debounce-decorator\n```\n\n## Usage\n\n```javascript\n// If using flow, grab the injected props type.\nimport type { InjectedProps } from 'react-debounce-decorator';\n\nimport debounceDecorator from 'react-debounce-decorator';\n\ndebounceDecorator(150)(\n  class View extends Component {\n    props: InjectedProps;\n\n    state: {\n      message: string,\n    } = { message: 'is anyone there?' };\n\n    hello = () =\u003e {\n      this.props.show(() =\u003e this.setState({\n        message: 'hello!',\n      }));\n    };\n\n    goodbye = () =\u003e {\n      this.props.hide(() =\u003e this.setState({\n        message: 'goodbye...',\n      }));\n    };\n\n    render () {\n      return (\n        \u003cdiv onMouseEnter={this.hello} onMouseLeave={this.goodbye}\u003e\n          {this.state.message}\n        \u003c/div\u003e\n      );\n    }\n  }\n)\n```\n\n## debounceDecorator(wait: number): (Component) =\u003e Component(hide, show)\n\nReturns a wrapped component that has injected props `show` and `hide`.\n\n## show(callback: Function): Function\n\nImmediately calls callback when called.\n\n## hide(callback: Function): Function\n\nCalls callback after the debounce duration has expired.\n\n### React Story Book\n\nTo run the component in various modes, run the following command then go to `http://localhost:6006/`.\n\n```bash\nnpm start\n```\n\n### Testing\n\n```bash\nnpm test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitsdouges%2Freact-debounce-decorator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitsdouges%2Freact-debounce-decorator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitsdouges%2Freact-debounce-decorator/lists"}