{"action":"created","issue":{"url":"https://api.github.com/repos/oliviertassinari/react-event-listener/issues/1","labels_url":"https://api.github.com/repos/oliviertassinari/react-event-listener/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/oliviertassinari/react-event-listener/issues/1/comments","events_url":"https://api.github.com/repos/oliviertassinari/react-event-listener/issues/1/events","html_url":"https://github.com/oliviertassinari/react-event-listener/issues/1","id":97824791,"number":1,"title":"visibilitychange event doesn't return document in 'this'","user":{"login":"morenoh149","id":587438,"avatar_url":"https://avatars.githubusercontent.com/u/587438?v=3","gravatar_id":"","url":"https://api.github.com/users/morenoh149","html_url":"https://github.com/morenoh149","followers_url":"https://api.github.com/users/morenoh149/followers","following_url":"https://api.github.com/users/morenoh149/following{/other_user}","gists_url":"https://api.github.com/users/morenoh149/gists{/gist_id}","starred_url":"https://api.github.com/users/morenoh149/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/morenoh149/subscriptions","organizations_url":"https://api.github.com/users/morenoh149/orgs","repos_url":"https://api.github.com/users/morenoh149/repos","events_url":"https://api.github.com/users/morenoh149/events{/privacy}","received_events_url":"https://api.github.com/users/morenoh149/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-28T23:45:41Z","updated_at":"2015-08-24T16:21:36Z","closed_at":null,"body":"Nice module.\r\nI'm trying the following\r\n```javascript\r\nimport React from 'react'\r\nimport Router from 'react-router'\r\nimport { Route, DefaultRoute, RouteHandler } from 'react-router'\r\nimport LocalStorageMixin from 'react-localstorage'\r\nimport EventListener from 'react-event-listener'\r\n\r\n/*\r\n * Top level Component\r\n */\r\nlet App = React.createClass({\r\n  mixins: [\r\n    EventListener,\r\n    LocalStorageMixin\r\n  ],\r\n  listeners: {\r\n    document: {\r\n      visibilitychange: 'onVisibilityChange'\r\n    }\r\n  },\r\n  onVisibilityChange: function() {\r\n    // the variable this refers to the document object\r\n    console.log('visbility state:', this)\r\n  },\r\n  render() {\r\n    return (\r\n      <RouteHandler />\r\n    )\r\n  }\r\n})\r\n```\r\nthe this object looks like\r\n![screenshot 2015-07-28 16 44 35](https://cloud.githubusercontent.com/assets/587438/8946750/f5bc8514-3547-11e5-83a7-84bedde32ece.png)\r\nI was expecting it to return the `document` object. Which would have [document.hidden](https://developer.mozilla.org/en-US/docs/Web/Guide/User_experience/Using_the_Page_Visibility_API)"},"comment":{"url":"https://api.github.com/repos/oliviertassinari/react-event-listener/issues/comments/134283834","html_url":"https://github.com/oliviertassinari/react-event-listener/issues/1#issuecomment-134283834","issue_url":"https://api.github.com/repos/oliviertassinari/react-event-listener/issues/1","id":134283834,"user":{"login":"oliviertassinari","id":3165635,"avatar_url":"https://avatars.githubusercontent.com/u/3165635?v=3","gravatar_id":"","url":"https://api.github.com/users/oliviertassinari","html_url":"https://github.com/oliviertassinari","followers_url":"https://api.github.com/users/oliviertassinari/followers","following_url":"https://api.github.com/users/oliviertassinari/following{/other_user}","gists_url":"https://api.github.com/users/oliviertassinari/gists{/gist_id}","starred_url":"https://api.github.com/users/oliviertassinari/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oliviertassinari/subscriptions","organizations_url":"https://api.github.com/users/oliviertassinari/orgs","repos_url":"https://api.github.com/users/oliviertassinari/repos","events_url":"https://api.github.com/users/oliviertassinari/events{/privacy}","received_events_url":"https://api.github.com/users/oliviertassinari/received_events","type":"User","site_admin":false},"created_at":"2015-08-24T16:21:36Z","updated_at":"2015-08-24T16:21:36Z","body":"Ok, looks like my documentation is wrong. May be the react autobinding that is responsible of this see https://facebook.github.io/react/blog/2013/07/02/react-v0-4-autobind-by-default.html. Let me investigate."}}