{"action":"closed","issue":{"url":"https://api.github.com/repos/seedofjoy/bazooka/issues/7","labels_url":"https://api.github.com/repos/seedofjoy/bazooka/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/seedofjoy/bazooka/issues/7/comments","events_url":"https://api.github.com/repos/seedofjoy/bazooka/issues/7/events","html_url":"https://github.com/seedofjoy/bazooka/issues/7","id":62610583,"number":7,"title":"Components communication","user":{"login":"zemlanin","id":711514,"avatar_url":"https://avatars.githubusercontent.com/u/711514?v=3","gravatar_id":"","url":"https://api.github.com/users/zemlanin","html_url":"https://github.com/zemlanin","followers_url":"https://api.github.com/users/zemlanin/followers","following_url":"https://api.github.com/users/zemlanin/following{/other_user}","gists_url":"https://api.github.com/users/zemlanin/gists{/gist_id}","starred_url":"https://api.github.com/users/zemlanin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zemlanin/subscriptions","organizations_url":"https://api.github.com/users/zemlanin/orgs","repos_url":"https://api.github.com/users/zemlanin/repos","events_url":"https://api.github.com/users/zemlanin/events{/privacy}","received_events_url":"https://api.github.com/users/zemlanin/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-18T07:10:42Z","updated_at":"2015-03-25T13:22:33Z","closed_at":"2015-03-25T13:22:33Z","body":"Baz needs some way to communicate between components\r\n\r\nMaybe, include special component for basic pub/sub. This way users could write their own communication layer based on $.Event/localStorage/AJAX/Rx/new-fancy-technology\r\n\r\n```javascript\r\nvar pubsub = function (element) {\r\n  Baz.r.method('sub', function (ev, cb) {  // `r` for register\r\n    // save callback to {ev:[]cb} map\r\n  });\r\n  Baz.r.method('pub', function (ev) {\r\n    // run callbacks from {ev:[]cb} map\r\n  });\r\n}\r\n\r\n// ###############\r\n\r\nvar clicker = function (element) {\r\n  $(element).onclick(Baz.g.method('pub', 'clicked'));  // `g` for get\r\n}\r\n\r\nvar ticker = function (element) {\r\n  Baz.g.method('sub', 'clicked', function(){\r\n    // handler for clicker's clicks\r\n  });\r\n}\r\n```"}}