{"action":"opened","number":22,"pull_request":{"url":"https://api.github.com/repos/yahoo/react-i13n/pulls/22","id":37326172,"html_url":"https://github.com/yahoo/react-i13n/pull/22","diff_url":"https://github.com/yahoo/react-i13n/pull/22.diff","patch_url":"https://github.com/yahoo/react-i13n/pull/22.patch","issue_url":"https://api.github.com/repos/yahoo/react-i13n/issues/22","number":22,"state":"open","locked":false,"title":"add I13nUtils mixin","user":{"login":"kaesonho","id":3829183,"avatar_url":"https://avatars.githubusercontent.com/u/3829183?v=3","gravatar_id":"","url":"https://api.github.com/users/kaesonho","html_url":"https://github.com/kaesonho","followers_url":"https://api.github.com/users/kaesonho/followers","following_url":"https://api.github.com/users/kaesonho/following{/other_user}","gists_url":"https://api.github.com/users/kaesonho/gists{/gist_id}","starred_url":"https://api.github.com/users/kaesonho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaesonho/subscriptions","organizations_url":"https://api.github.com/users/kaesonho/orgs","repos_url":"https://api.github.com/users/kaesonho/repos","events_url":"https://api.github.com/users/kaesonho/events{/privacy}","received_events_url":"https://api.github.com/users/kaesonho/received_events","type":"User","site_admin":false},"body":"@redonkulus @lingyan \r\n\r\nprovide `i13n utils mixins` for users to have a easier way to access i13n node and execute i13n event\r\n(move some shared functions to i13nUtils, to provide a small mixin for i13n functionalities)\r\n\r\n### getI13nNode\r\nwhen we use `createI13nNode` to decorate a node, for example `createI13nNode(Foo)`, it generate a template like\r\n```\r\n<I13nFoo> // everything about i13n and creating i13nNode happens here\r\n     <Foo />\r\n</13nFoo>\r\n```\r\n\r\nin Foo, we might have some case want to access the i13n node, so provide `getI13nNode` to get the nearest i13nNode in context passed from parents. \r\n\r\nIn the end, they are do something like\r\n```\r\nvar I13nUtils = require('react-i13n').I13nUtils;\r\nvar DemoComponent = React.createClass({\r\n    mixins: [I13nUtils],\r\n    displayName: 'DemoComponent',\r\n    render: function() {\r\n        // this.getI13nNode() to access the i13nNode created by createI13nNode\r\n    }\r\n});\r\n```\r\n\r\n### executeI13nEvent\r\npreviously users will have to fire events like\r\n```\r\nvar DemoComponent = React.createClass({\r\n    displayName: 'DemoComponent',\r\n    componentDidMount: function () {\r\n         ReactI13n.getInstance.execute('pageview', {});\r\n    }\r\n});\r\n```\r\n\r\nnow we provide executeI13nEvent for them, we can add some error handling and get the i13nNode into payload for them\r\n```\r\nvar I13nUtils = require('react-i13n').I13nUtils;\r\nvar DemoComponent = React.createClass({\r\n    mixins: [I13nUtils],\r\n    displayName: 'DemoComponent',\r\n    componentDidMount: function () {\r\n        // executeI13nEvent will find the i13nNode and append to the payload for you, which means the final payload will be\r\n        // {i13nNode: [theI13nNode], foo: 'bar'}\r\n        this.executeI13nEvent('someEventName', {foo: 'bar'}, function callback() {\r\n            // callback\r\n        });\r\n    }\r\n});\r\n```","created_at":"2015-06-10T05:51:15Z","updated_at":"2015-06-10T05:51:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"308206121130a9de3a0274ffda277465e690abca","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/yahoo/react-i13n/pulls/22/commits","review_comments_url":"https://api.github.com/repos/yahoo/react-i13n/pulls/22/comments","review_comment_url":"https://api.github.com/repos/yahoo/react-i13n/pulls/comments{/number}","comments_url":"https://api.github.com/repos/yahoo/react-i13n/issues/22/comments","statuses_url":"https://api.github.com/repos/yahoo/react-i13n/statuses/d5c845f59017ff9953b0091c12c3b7a5dc569308","head":{"label":"yahoo:addI13nUtils","ref":"addI13nUtils","sha":"d5c845f59017ff9953b0091c12c3b7a5dc569308","user":{"login":"yahoo","id":16574,"avatar_url":"https://avatars.githubusercontent.com/u/16574?v=3","gravatar_id":"","url":"https://api.github.com/users/yahoo","html_url":"https://github.com/yahoo","followers_url":"https://api.github.com/users/yahoo/followers","following_url":"https://api.github.com/users/yahoo/following{/other_user}","gists_url":"https://api.github.com/users/yahoo/gists{/gist_id}","starred_url":"https://api.github.com/users/yahoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yahoo/subscriptions","organizations_url":"https://api.github.com/users/yahoo/orgs","repos_url":"https://api.github.com/users/yahoo/repos","events_url":"https://api.github.com/users/yahoo/events{/privacy}","received_events_url":"https://api.github.com/users/yahoo/received_events","type":"Organization","site_admin":false},"repo":{"id":36094164,"name":"react-i13n","full_name":"yahoo/react-i13n","owner":{"login":"yahoo","id":16574,"avatar_url":"https://avatars.githubusercontent.com/u/16574?v=3","gravatar_id":"","url":"https://api.github.com/users/yahoo","html_url":"https://github.com/yahoo","followers_url":"https://api.github.com/users/yahoo/followers","following_url":"https://api.github.com/users/yahoo/following{/other_user}","gists_url":"https://api.github.com/users/yahoo/gists{/gist_id}","starred_url":"https://api.github.com/users/yahoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yahoo/subscriptions","organizations_url":"https://api.github.com/users/yahoo/orgs","repos_url":"https://api.github.com/users/yahoo/repos","events_url":"https://api.github.com/users/yahoo/events{/privacy}","received_events_url":"https://api.github.com/users/yahoo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/yahoo/react-i13n","description":"React I13n provides a performant and scalable approach to instrumentation.","fork":false,"url":"https://api.github.com/repos/yahoo/react-i13n","forks_url":"https://api.github.com/repos/yahoo/react-i13n/forks","keys_url":"https://api.github.com/repos/yahoo/react-i13n/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yahoo/react-i13n/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yahoo/react-i13n/teams","hooks_url":"https://api.github.com/repos/yahoo/react-i13n/hooks","issue_events_url":"https://api.github.com/repos/yahoo/react-i13n/issues/events{/number}","events_url":"https://api.github.com/repos/yahoo/react-i13n/events","assignees_url":"https://api.github.com/repos/yahoo/react-i13n/assignees{/user}","branches_url":"https://api.github.com/repos/yahoo/react-i13n/branches{/branch}","tags_url":"https://api.github.com/repos/yahoo/react-i13n/tags","blobs_url":"https://api.github.com/repos/yahoo/react-i13n/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yahoo/react-i13n/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yahoo/react-i13n/git/refs{/sha}","trees_url":"https://api.github.com/repos/yahoo/react-i13n/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yahoo/react-i13n/statuses/{sha}","languages_url":"https://api.github.com/repos/yahoo/react-i13n/languages","stargazers_url":"https://api.github.com/repos/yahoo/react-i13n/stargazers","contributors_url":"https://api.github.com/repos/yahoo/react-i13n/contributors","subscribers_url":"https://api.github.com/repos/yahoo/react-i13n/subscribers","subscription_url":"https://api.github.com/repos/yahoo/react-i13n/subscription","commits_url":"https://api.github.com/repos/yahoo/react-i13n/commits{/sha}","git_commits_url":"https://api.github.com/repos/yahoo/react-i13n/git/commits{/sha}","comments_url":"https://api.github.com/repos/yahoo/react-i13n/comments{/number}","issue_comment_url":"https://api.github.com/repos/yahoo/react-i13n/issues/comments{/number}","contents_url":"https://api.github.com/repos/yahoo/react-i13n/contents/{+path}","compare_url":"https://api.github.com/repos/yahoo/react-i13n/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yahoo/react-i13n/merges","archive_url":"https://api.github.com/repos/yahoo/react-i13n/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yahoo/react-i13n/downloads","issues_url":"https://api.github.com/repos/yahoo/react-i13n/issues{/number}","pulls_url":"https://api.github.com/repos/yahoo/react-i13n/pulls{/number}","milestones_url":"https://api.github.com/repos/yahoo/react-i13n/milestones{/number}","notifications_url":"https://api.github.com/repos/yahoo/react-i13n/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yahoo/react-i13n/labels{/name}","releases_url":"https://api.github.com/repos/yahoo/react-i13n/releases{/id}","created_at":"2015-05-22T20:37:44Z","updated_at":"2015-06-09T23:50:24Z","pushed_at":"2015-06-10T05:51:15Z","git_url":"git://github.com/yahoo/react-i13n.git","ssh_url":"git@github.com:yahoo/react-i13n.git","clone_url":"https://github.com/yahoo/react-i13n.git","svn_url":"https://github.com/yahoo/react-i13n","homepage":"","size":652,"stargazers_count":6,"watchers_count":6,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":7,"forks":0,"open_issues":7,"watchers":6,"default_branch":"master"}},"base":{"label":"yahoo:master","ref":"master","sha":"a27491d6568fba128b80f62fbd6cf476a4d28b85","user":{"login":"yahoo","id":16574,"avatar_url":"https://avatars.githubusercontent.com/u/16574?v=3","gravatar_id":"","url":"https://api.github.com/users/yahoo","html_url":"https://github.com/yahoo","followers_url":"https://api.github.com/users/yahoo/followers","following_url":"https://api.github.com/users/yahoo/following{/other_user}","gists_url":"https://api.github.com/users/yahoo/gists{/gist_id}","starred_url":"https://api.github.com/users/yahoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yahoo/subscriptions","organizations_url":"https://api.github.com/users/yahoo/orgs","repos_url":"https://api.github.com/users/yahoo/repos","events_url":"https://api.github.com/users/yahoo/events{/privacy}","received_events_url":"https://api.github.com/users/yahoo/received_events","type":"Organization","site_admin":false},"repo":{"id":36094164,"name":"react-i13n","full_name":"yahoo/react-i13n","owner":{"login":"yahoo","id":16574,"avatar_url":"https://avatars.githubusercontent.com/u/16574?v=3","gravatar_id":"","url":"https://api.github.com/users/yahoo","html_url":"https://github.com/yahoo","followers_url":"https://api.github.com/users/yahoo/followers","following_url":"https://api.github.com/users/yahoo/following{/other_user}","gists_url":"https://api.github.com/users/yahoo/gists{/gist_id}","starred_url":"https://api.github.com/users/yahoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yahoo/subscriptions","organizations_url":"https://api.github.com/users/yahoo/orgs","repos_url":"https://api.github.com/users/yahoo/repos","events_url":"https://api.github.com/users/yahoo/events{/privacy}","received_events_url":"https://api.github.com/users/yahoo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/yahoo/react-i13n","description":"React I13n provides a performant and scalable approach to instrumentation.","fork":false,"url":"https://api.github.com/repos/yahoo/react-i13n","forks_url":"https://api.github.com/repos/yahoo/react-i13n/forks","keys_url":"https://api.github.com/repos/yahoo/react-i13n/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yahoo/react-i13n/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yahoo/react-i13n/teams","hooks_url":"https://api.github.com/repos/yahoo/react-i13n/hooks","issue_events_url":"https://api.github.com/repos/yahoo/react-i13n/issues/events{/number}","events_url":"https://api.github.com/repos/yahoo/react-i13n/events","assignees_url":"https://api.github.com/repos/yahoo/react-i13n/assignees{/user}","branches_url":"https://api.github.com/repos/yahoo/react-i13n/branches{/branch}","tags_url":"https://api.github.com/repos/yahoo/react-i13n/tags","blobs_url":"https://api.github.com/repos/yahoo/react-i13n/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yahoo/react-i13n/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yahoo/react-i13n/git/refs{/sha}","trees_url":"https://api.github.com/repos/yahoo/react-i13n/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yahoo/react-i13n/statuses/{sha}","languages_url":"https://api.github.com/repos/yahoo/react-i13n/languages","stargazers_url":"https://api.github.com/repos/yahoo/react-i13n/stargazers","contributors_url":"https://api.github.com/repos/yahoo/react-i13n/contributors","subscribers_url":"https://api.github.com/repos/yahoo/react-i13n/subscribers","subscription_url":"https://api.github.com/repos/yahoo/react-i13n/subscription","commits_url":"https://api.github.com/repos/yahoo/react-i13n/commits{/sha}","git_commits_url":"https://api.github.com/repos/yahoo/react-i13n/git/commits{/sha}","comments_url":"https://api.github.com/repos/yahoo/react-i13n/comments{/number}","issue_comment_url":"https://api.github.com/repos/yahoo/react-i13n/issues/comments{/number}","contents_url":"https://api.github.com/repos/yahoo/react-i13n/contents/{+path}","compare_url":"https://api.github.com/repos/yahoo/react-i13n/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yahoo/react-i13n/merges","archive_url":"https://api.github.com/repos/yahoo/react-i13n/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yahoo/react-i13n/downloads","issues_url":"https://api.github.com/repos/yahoo/react-i13n/issues{/number}","pulls_url":"https://api.github.com/repos/yahoo/react-i13n/pulls{/number}","milestones_url":"https://api.github.com/repos/yahoo/react-i13n/milestones{/number}","notifications_url":"https://api.github.com/repos/yahoo/react-i13n/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yahoo/react-i13n/labels{/name}","releases_url":"https://api.github.com/repos/yahoo/react-i13n/releases{/id}","created_at":"2015-05-22T20:37:44Z","updated_at":"2015-06-09T23:50:24Z","pushed_at":"2015-06-10T05:51:15Z","git_url":"git://github.com/yahoo/react-i13n.git","ssh_url":"git@github.com:yahoo/react-i13n.git","clone_url":"https://github.com/yahoo/react-i13n.git","svn_url":"https://github.com/yahoo/react-i13n","homepage":"","size":652,"stargazers_count":6,"watchers_count":6,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":7,"forks":0,"open_issues":7,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/yahoo/react-i13n/pulls/22"},"html":{"href":"https://github.com/yahoo/react-i13n/pull/22"},"issue":{"href":"https://api.github.com/repos/yahoo/react-i13n/issues/22"},"comments":{"href":"https://api.github.com/repos/yahoo/react-i13n/issues/22/comments"},"review_comments":{"href":"https://api.github.com/repos/yahoo/react-i13n/pulls/22/comments"},"review_comment":{"href":"https://api.github.com/repos/yahoo/react-i13n/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/yahoo/react-i13n/pulls/22/commits"},"statuses":{"href":"https://api.github.com/repos/yahoo/react-i13n/statuses/d5c845f59017ff9953b0091c12c3b7a5dc569308"}},"merged":false,"mergeable":true,"mergeable_state":"clean","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":176,"deletions":58,"changed_files":13}}