lab11 / accessors

A collection of accessors for Lab11 and other supporting code.
0 stars 1 forks source link

Another issue with function* #43

Open bradjc opened 9 years ago

bradjc commented 9 years ago

This doesn't work:

ssdp_client.on('response' function* (headers) {
  yield* http.get(headers.location);
});

ssdp_client.search('ssdp:all');

If you omit the * in the callback it doesn't know what yield is, and if you make it function* it doesn't get called properly.

ppannuto commented 9 years ago

You need to wrap the root of event chains using _do_port_call. Usually event chains start from within runtime , but for a callback like this, you'll need to do it yourself. Not unlike the timer lib implementation. On Sat, Jun 20, 2015 at 22:26 Brad Campbell notifications@github.com wrote:

This doesn't work:

ssdp_client.on('response' function* (headers) { yield* http.get(headers.location); });

ssdp_client.search('ssdp:all');

If you omit the * in the callback it doesn't know what yield is, and if you make it function* it doesn't get called properly.

— Reply to this email directly or view it on GitHub https://github.com/lab11/accessors/issues/43.