{"action":"created","issue":{"url":"https://api.github.com/repos/pozadi/kefir/issues/34","labels_url":"https://api.github.com/repos/pozadi/kefir/issues/34/labels{/name}","comments_url":"https://api.github.com/repos/pozadi/kefir/issues/34/comments","events_url":"https://api.github.com/repos/pozadi/kefir/issues/34/events","html_url":"https://github.com/pozadi/kefir/issues/34","id":53999945,"number":34,"title":"Zip with property not producing anything unless property has a subscriber","user":{"login":"myndzi","id":1588419,"avatar_url":"https://avatars.githubusercontent.com/u/1588419?v=3","gravatar_id":"","url":"https://api.github.com/users/myndzi","html_url":"https://github.com/myndzi","followers_url":"https://api.github.com/users/myndzi/followers","following_url":"https://api.github.com/users/myndzi/following{/other_user}","gists_url":"https://api.github.com/users/myndzi/gists{/gist_id}","starred_url":"https://api.github.com/users/myndzi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/myndzi/subscriptions","organizations_url":"https://api.github.com/users/myndzi/orgs","repos_url":"https://api.github.com/users/myndzi/repos","events_url":"https://api.github.com/users/myndzi/events{/privacy}","received_events_url":"https://api.github.com/users/myndzi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-01-11T18:31:14Z","updated_at":"2015-01-11T19:28:37Z","closed_at":null,"body":"I'm trying to gather data from an html document; some of the data is static or periodic, but at the lowest level I want to associate these values with items in a list. I've created some helpers to give me streams and data, but I'm having some difficulty when combining them.\r\n\r\nExample: in the header of the page is a span containing a location. It occurs only once on the page, but it occurs before any of the list items I'm interested in. I do something like this:\r\n\r\n    var location = select(tokenized, '#header span.city')\r\n        .flatMap(innerText)\r\n        .toProperty();\r\n\r\n    var item = select(tokenized, 'ul.results a')\r\n        .flatMap(function (obs) {\r\n            var hrefs = obs.flatMap(attr('href')),\r\n                innerText = obs.flatMap(innerText);\r\n\r\n            return Kefir.zip([location, href, innerText]);\r\n        });\r\n\r\n    item.onValue(function (a) {\r\n        console.log(a);\r\n    });\r\n\r\nRun as-is, I get nothing. But if I call `location.onValue(function () { });` it works as expected. I would expect Kefir.zip to act as a subscriber on 'location', but it appears not to. Is this a bug or intentional? What should I be doing instead, if intentional?"},"comment":{"url":"https://api.github.com/repos/pozadi/kefir/issues/comments/69507321","html_url":"https://github.com/pozadi/kefir/issues/34#issuecomment-69507321","issue_url":"https://api.github.com/repos/pozadi/kefir/issues/34","id":69507321,"user":{"login":"pozadi","id":825702,"avatar_url":"https://avatars.githubusercontent.com/u/825702?v=3","gravatar_id":"","url":"https://api.github.com/users/pozadi","html_url":"https://github.com/pozadi","followers_url":"https://api.github.com/users/pozadi/followers","following_url":"https://api.github.com/users/pozadi/following{/other_user}","gists_url":"https://api.github.com/users/pozadi/gists{/gist_id}","starred_url":"https://api.github.com/users/pozadi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pozadi/subscriptions","organizations_url":"https://api.github.com/users/pozadi/orgs","repos_url":"https://api.github.com/users/pozadi/repos","events_url":"https://api.github.com/users/pozadi/events{/privacy}","received_events_url":"https://api.github.com/users/pozadi/received_events","type":"User","site_admin":false},"created_at":"2015-01-11T19:28:37Z","updated_at":"2015-01-11T19:28:37Z","body":"The \"control over the active state\" means that `.fromBinder` allows you to know when first subscriber is added to the stream you that you created and when the last one is removed.\r\n\r\nThe reason why your code is not working might be is because you are using emitters. Consider this example:\r\n\r\n```\r\nvar a = Kefir.emitter();\r\nvar b = a.toProperty();\r\n\r\na.emit(1); // the `b` property will not get this value because it not listening to `a` yet. It will begin to listen to `a` only when the `b` itself get first subscriber\r\n\r\nb.log(); // will not print anything as `b` didn't get the `1` value  \r\n```\r\n\r\nYou can solve this, using the `.fromBinder` method:\r\n\r\n```\r\nvar a = Kefir.fromBinder(function(emitter) {\r\n // When we inside this function, it means that `a` has a subscriber, in this case the `b` property subscribed to `a`\r\n\r\n  emitter.emit(1);\r\n});\r\nvar b = a.toProperty();\r\n\r\nb.log(); \r\n```\r\n\r\nYou can read more about active state in docs https://pozadi.github.io/kefir/#active-state (especially the _note_ section)\r\n\r\nTry to rewrite you code using `.fromBinder` method, if it still won't work please let me know."}}