I basically know how to use them; for instance listening to the onClick Stream of an Element.
But, how do you set up your own Streams?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Simple example
Here’s a complete working example:
You can also do cool things like check if there are subscribers with
controller.hasListeneror you can signal an error. Be sure to check the API documentation onStreamController.You can use
new StreamController.broadcast()for allowing multiple listeners.For copy-pasters
Here’s a simple way to create a stream (great snippet for copy-pasters):
Then the class can just access
_onExitControllerto control the stream (to for example.add()).