asEventStream
creates an Bacon.js EventStream from a jQuery event. So you can you only apply it to a jQuery object, not to a JavaScript variable. So in your case you can use the jQuery/HTML5 event hashchange
to create an EventStream from its changes:
$(window).asEventStream('hashchange')
.map(function () { return window.location.hash; });
There is no way to convert a variable by itsself to a EventStream or Property, because there needs to be a way to notify about changes, which normal variables do not supply. However, you can use a Bacon.Bus
to create an EventStream or Property, given that you call push
whenever the variables changes.