{"action":"opened","number":720,"pull_request":{"url":"https://api.github.com/repos/reactioncommerce/reaction/pulls/720","id":56801032,"html_url":"https://github.com/reactioncommerce/reaction/pull/720","diff_url":"https://github.com/reactioncommerce/reaction/pull/720.diff","patch_url":"https://github.com/reactioncommerce/reaction/pull/720.patch","issue_url":"https://api.github.com/repos/reactioncommerce/reaction/issues/720","number":720,"state":"open","locked":false,"title":"add base event hooks methods and implement a few","user":{"login":"jshimko","id":3077956,"avatar_url":"https://avatars.githubusercontent.com/u/3077956?v=3","gravatar_id":"","url":"https://api.github.com/users/jshimko","html_url":"https://github.com/jshimko","followers_url":"https://api.github.com/users/jshimko/followers","following_url":"https://api.github.com/users/jshimko/following{/other_user}","gists_url":"https://api.github.com/users/jshimko/gists{/gist_id}","starred_url":"https://api.github.com/users/jshimko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jshimko/subscriptions","organizations_url":"https://api.github.com/users/jshimko/orgs","repos_url":"https://api.github.com/users/jshimko/repos","events_url":"https://api.github.com/users/jshimko/events{/privacy}","received_events_url":"https://api.github.com/users/jshimko/received_events","type":"User","site_admin":false},"body":"Initial WIP implementation of event hooks to be used in places that can't be reached with Collection or Method hooks.\r\n\r\n### Methods\r\n\r\n```js\r\nReactionCore.Hooks.Events.add(hookName, func(doc));\r\nReactionCore.Hooks.Events.remove(hookName, funcName);\r\nReactionCore.Hooks.Events.run(hookName, doc, constant);\r\nReactionCore.Hooks.Events.runAsync(hookName, doc, constant);\r\n```\r\n\r\n### Example usage\r\n```js\r\nAccounts.onCreateUser(function(options, user) {\r\n  // add a hook to alter the user object or do something with its data\r\n  user = ReactionCore.Hooks.Events.run(\"onCreateUser\", user, options);\r\n});\r\n```\r\n\r\nNow you can pass any amount of functions into that hook from anywhere else in the app\r\n\r\n```js\r\n// create a callback to run\r\nfunction logUserEmail(user) {\r\n  console.log(\"User being created with email: \" + user.emails[0].address);\r\n  // do whatever with the user doc and then return it \r\n  // to the next callback\r\n  return user;\r\n}\r\n\r\n// add your callback to the hooks array created above\r\nReactionCore.Hooks.Events.add(\"onCreateUser\", logUserEmail);\r\n```\r\n\r\n## Currently available hooks\r\n\r\n```js\r\nReactionCore.Hooks.Events.add(\"beforeCreateDefaultAdminUser\", callback);\r\nReactionCore.Hooks.Events.add(\"beforeCreateDefaultAdminUser\", callback);\r\n\r\n\r\n```","created_at":"2016-01-21T20:01:41Z","updated_at":"2016-01-21T20:01:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/reactioncommerce/reaction/pulls/720/commits","review_comments_url":"https://api.github.com/repos/reactioncommerce/reaction/pulls/720/comments","review_comment_url":"https://api.github.com/repos/reactioncommerce/reaction/pulls/comments{/number}","comments_url":"https://api.github.com/repos/reactioncommerce/reaction/issues/720/comments","statuses_url":"https://api.github.com/repos/reactioncommerce/reaction/statuses/74bcb817ea1f6de2096c728f4068b6d52fea844a","head":{"label":"reactioncommerce:event-hooks","ref":"event-hooks","sha":"74bcb817ea1f6de2096c728f4068b6d52fea844a","user":{"login":"reactioncommerce","id":5605462,"avatar_url":"https://avatars.githubusercontent.com/u/5605462?v=3","gravatar_id":"","url":"https://api.github.com/users/reactioncommerce","html_url":"https://github.com/reactioncommerce","followers_url":"https://api.github.com/users/reactioncommerce/followers","following_url":"https://api.github.com/users/reactioncommerce/following{/other_user}","gists_url":"https://api.github.com/users/reactioncommerce/gists{/gist_id}","starred_url":"https://api.github.com/users/reactioncommerce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reactioncommerce/subscriptions","organizations_url":"https://api.github.com/users/reactioncommerce/orgs","repos_url":"https://api.github.com/users/reactioncommerce/repos","events_url":"https://api.github.com/users/reactioncommerce/events{/privacy}","received_events_url":"https://api.github.com/users/reactioncommerce/received_events","type":"Organization","site_admin":false},"repo":{"id":12926963,"name":"reaction","full_name":"reactioncommerce/reaction","owner":{"login":"reactioncommerce","id":5605462,"avatar_url":"https://avatars.githubusercontent.com/u/5605462?v=3","gravatar_id":"","url":"https://api.github.com/users/reactioncommerce","html_url":"https://github.com/reactioncommerce","followers_url":"https://api.github.com/users/reactioncommerce/followers","following_url":"https://api.github.com/users/reactioncommerce/following{/other_user}","gists_url":"https://api.github.com/users/reactioncommerce/gists{/gist_id}","starred_url":"https://api.github.com/users/reactioncommerce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reactioncommerce/subscriptions","organizations_url":"https://api.github.com/users/reactioncommerce/orgs","repos_url":"https://api.github.com/users/reactioncommerce/repos","events_url":"https://api.github.com/users/reactioncommerce/events{/privacy}","received_events_url":"https://api.github.com/users/reactioncommerce/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/reactioncommerce/reaction","description":"Reaction Commerce","fork":false,"url":"https://api.github.com/repos/reactioncommerce/reaction","forks_url":"https://api.github.com/repos/reactioncommerce/reaction/forks","keys_url":"https://api.github.com/repos/reactioncommerce/reaction/keys{/key_id}","collaborators_url":"https://api.github.com/repos/reactioncommerce/reaction/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/reactioncommerce/reaction/teams","hooks_url":"https://api.github.com/repos/reactioncommerce/reaction/hooks","issue_events_url":"https://api.github.com/repos/reactioncommerce/reaction/issues/events{/number}","events_url":"https://api.github.com/repos/reactioncommerce/reaction/events","assignees_url":"https://api.github.com/repos/reactioncommerce/reaction/assignees{/user}","branches_url":"https://api.github.com/repos/reactioncommerce/reaction/branches{/branch}","tags_url":"https://api.github.com/repos/reactioncommerce/reaction/tags","blobs_url":"https://api.github.com/repos/reactioncommerce/reaction/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/reactioncommerce/reaction/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/reactioncommerce/reaction/git/refs{/sha}","trees_url":"https://api.github.com/repos/reactioncommerce/reaction/git/trees{/sha}","statuses_url":"https://api.github.com/repos/reactioncommerce/reaction/statuses/{sha}","languages_url":"https://api.github.com/repos/reactioncommerce/reaction/languages","stargazers_url":"https://api.github.com/repos/reactioncommerce/reaction/stargazers","contributors_url":"https://api.github.com/repos/reactioncommerce/reaction/contributors","subscribers_url":"https://api.github.com/repos/reactioncommerce/reaction/subscribers","subscription_url":"https://api.github.com/repos/reactioncommerce/reaction/subscription","commits_url":"https://api.github.com/repos/reactioncommerce/reaction/commits{/sha}","git_commits_url":"https://api.github.com/repos/reactioncommerce/reaction/git/commits{/sha}","comments_url":"https://api.github.com/repos/reactioncommerce/reaction/comments{/number}","issue_comment_url":"https://api.github.com/repos/reactioncommerce/reaction/issues/comments{/number}","contents_url":"https://api.github.com/repos/reactioncommerce/reaction/contents/{+path}","compare_url":"https://api.github.com/repos/reactioncommerce/reaction/compare/{base}...{head}","merges_url":"https://api.github.com/repos/reactioncommerce/reaction/merges","archive_url":"https://api.github.com/repos/reactioncommerce/reaction/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/reactioncommerce/reaction/downloads","issues_url":"https://api.github.com/repos/reactioncommerce/reaction/issues{/number}","pulls_url":"https://api.github.com/repos/reactioncommerce/reaction/pulls{/number}","milestones_url":"https://api.github.com/repos/reactioncommerce/reaction/milestones{/number}","notifications_url":"https://api.github.com/repos/reactioncommerce/reaction/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/reactioncommerce/reaction/labels{/name}","releases_url":"https://api.github.com/repos/reactioncommerce/reaction/releases{/id}","created_at":"2013-09-18T15:30:36Z","updated_at":"2016-01-21T11:19:56Z","pushed_at":"2016-01-21T19:26:09Z","git_url":"git://github.com/reactioncommerce/reaction.git","ssh_url":"git@github.com:reactioncommerce/reaction.git","clone_url":"https://github.com/reactioncommerce/reaction.git","svn_url":"https://github.com/reactioncommerce/reaction","homepage":"https://reactioncommerce.com/","size":29943,"stargazers_count":1877,"watchers_count":1877,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":384,"mirror_url":null,"open_issues_count":164,"forks":384,"open_issues":164,"watchers":1877,"default_branch":"development"}},"base":{"label":"reactioncommerce:development","ref":"development","sha":"69f4dffc57712bb86c9b0cd69b7a35aa8a5625d2","user":{"login":"reactioncommerce","id":5605462,"avatar_url":"https://avatars.githubusercontent.com/u/5605462?v=3","gravatar_id":"","url":"https://api.github.com/users/reactioncommerce","html_url":"https://github.com/reactioncommerce","followers_url":"https://api.github.com/users/reactioncommerce/followers","following_url":"https://api.github.com/users/reactioncommerce/following{/other_user}","gists_url":"https://api.github.com/users/reactioncommerce/gists{/gist_id}","starred_url":"https://api.github.com/users/reactioncommerce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reactioncommerce/subscriptions","organizations_url":"https://api.github.com/users/reactioncommerce/orgs","repos_url":"https://api.github.com/users/reactioncommerce/repos","events_url":"https://api.github.com/users/reactioncommerce/events{/privacy}","received_events_url":"https://api.github.com/users/reactioncommerce/received_events","type":"Organization","site_admin":false},"repo":{"id":12926963,"name":"reaction","full_name":"reactioncommerce/reaction","owner":{"login":"reactioncommerce","id":5605462,"avatar_url":"https://avatars.githubusercontent.com/u/5605462?v=3","gravatar_id":"","url":"https://api.github.com/users/reactioncommerce","html_url":"https://github.com/reactioncommerce","followers_url":"https://api.github.com/users/reactioncommerce/followers","following_url":"https://api.github.com/users/reactioncommerce/following{/other_user}","gists_url":"https://api.github.com/users/reactioncommerce/gists{/gist_id}","starred_url":"https://api.github.com/users/reactioncommerce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reactioncommerce/subscriptions","organizations_url":"https://api.github.com/users/reactioncommerce/orgs","repos_url":"https://api.github.com/users/reactioncommerce/repos","events_url":"https://api.github.com/users/reactioncommerce/events{/privacy}","received_events_url":"https://api.github.com/users/reactioncommerce/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/reactioncommerce/reaction","description":"Reaction Commerce","fork":false,"url":"https://api.github.com/repos/reactioncommerce/reaction","forks_url":"https://api.github.com/repos/reactioncommerce/reaction/forks","keys_url":"https://api.github.com/repos/reactioncommerce/reaction/keys{/key_id}","collaborators_url":"https://api.github.com/repos/reactioncommerce/reaction/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/reactioncommerce/reaction/teams","hooks_url":"https://api.github.com/repos/reactioncommerce/reaction/hooks","issue_events_url":"https://api.github.com/repos/reactioncommerce/reaction/issues/events{/number}","events_url":"https://api.github.com/repos/reactioncommerce/reaction/events","assignees_url":"https://api.github.com/repos/reactioncommerce/reaction/assignees{/user}","branches_url":"https://api.github.com/repos/reactioncommerce/reaction/branches{/branch}","tags_url":"https://api.github.com/repos/reactioncommerce/reaction/tags","blobs_url":"https://api.github.com/repos/reactioncommerce/reaction/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/reactioncommerce/reaction/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/reactioncommerce/reaction/git/refs{/sha}","trees_url":"https://api.github.com/repos/reactioncommerce/reaction/git/trees{/sha}","statuses_url":"https://api.github.com/repos/reactioncommerce/reaction/statuses/{sha}","languages_url":"https://api.github.com/repos/reactioncommerce/reaction/languages","stargazers_url":"https://api.github.com/repos/reactioncommerce/reaction/stargazers","contributors_url":"https://api.github.com/repos/reactioncommerce/reaction/contributors","subscribers_url":"https://api.github.com/repos/reactioncommerce/reaction/subscribers","subscription_url":"https://api.github.com/repos/reactioncommerce/reaction/subscription","commits_url":"https://api.github.com/repos/reactioncommerce/reaction/commits{/sha}","git_commits_url":"https://api.github.com/repos/reactioncommerce/reaction/git/commits{/sha}","comments_url":"https://api.github.com/repos/reactioncommerce/reaction/comments{/number}","issue_comment_url":"https://api.github.com/repos/reactioncommerce/reaction/issues/comments{/number}","contents_url":"https://api.github.com/repos/reactioncommerce/reaction/contents/{+path}","compare_url":"https://api.github.com/repos/reactioncommerce/reaction/compare/{base}...{head}","merges_url":"https://api.github.com/repos/reactioncommerce/reaction/merges","archive_url":"https://api.github.com/repos/reactioncommerce/reaction/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/reactioncommerce/reaction/downloads","issues_url":"https://api.github.com/repos/reactioncommerce/reaction/issues{/number}","pulls_url":"https://api.github.com/repos/reactioncommerce/reaction/pulls{/number}","milestones_url":"https://api.github.com/repos/reactioncommerce/reaction/milestones{/number}","notifications_url":"https://api.github.com/repos/reactioncommerce/reaction/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/reactioncommerce/reaction/labels{/name}","releases_url":"https://api.github.com/repos/reactioncommerce/reaction/releases{/id}","created_at":"2013-09-18T15:30:36Z","updated_at":"2016-01-21T11:19:56Z","pushed_at":"2016-01-21T19:26:09Z","git_url":"git://github.com/reactioncommerce/reaction.git","ssh_url":"git@github.com:reactioncommerce/reaction.git","clone_url":"https://github.com/reactioncommerce/reaction.git","svn_url":"https://github.com/reactioncommerce/reaction","homepage":"https://reactioncommerce.com/","size":29943,"stargazers_count":1877,"watchers_count":1877,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":384,"mirror_url":null,"open_issues_count":164,"forks":384,"open_issues":164,"watchers":1877,"default_branch":"development"}},"_links":{"self":{"href":"https://api.github.com/repos/reactioncommerce/reaction/pulls/720"},"html":{"href":"https://github.com/reactioncommerce/reaction/pull/720"},"issue":{"href":"https://api.github.com/repos/reactioncommerce/reaction/issues/720"},"comments":{"href":"https://api.github.com/repos/reactioncommerce/reaction/issues/720/comments"},"review_comments":{"href":"https://api.github.com/repos/reactioncommerce/reaction/pulls/720/comments"},"review_comment":{"href":"https://api.github.com/repos/reactioncommerce/reaction/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/reactioncommerce/reaction/pulls/720/commits"},"statuses":{"href":"https://api.github.com/repos/reactioncommerce/reaction/statuses/74bcb817ea1f6de2096c728f4068b6d52fea844a"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":105,"deletions":16,"changed_files":4}}