This way should work in node 0.8 and 0.10. the 0.11 branch bring an significant update of the underlying v8 API.
The file I sent you gathers a set of functions that handle music delivery in spotify which is a continuous flow of data. I assume the same patterns can be applied for a sensor like yours. On Tuesday, 17 December 2013 15:04:43 UTC+1, Miikka Miettinen wrote: > > Hi Floby, > > I'm currently using v0.8.11 but upgrading wouldn't be a problem. I didn't > study your example in detail yet, but it looks very relevant. Thanks! > > --Miikka > > > On Dec 17, 2013, at 11:58 AM, Floby <[email protected] <javascript:>> > wrote: > > Hello, it may not seems so, but it is important that you specify against > which version of node you are trying to build your addon. > > for the 0.10 branch, I have some code in node-libspotify that can help you > out. It gets sound data chunks and stores them in a queue. this > function<https://github.com/Floby/node-libspotify/blob/master/src/player.cc#L102> > reads > it occasionally and pushed the data to a JS callback. Hope it helps you. > > On Monday, 16 December 2013 15:41:20 UTC+1, [email protected] wrote: >> >> Hi, >> >> I'm trying to create a native module in order to receive data from a kind >> of sensor. To get updated, I need to provide 2 implementations of the same >> interface, which consists of a single method with the signature >> void receiveData(const Data& data). >> >> My problem is that I haven't been able to figure out how to pass the data >> forward to JavaScript. I suppose this requires the use of Handle, >> HandleScope etc. but how exactly would I make the call from receiveData to >> another object to do the necessary wrapping? Any example or sketch would be >> very helpful. >> >> Thanks, >> Miikka >> >> > -- > -- > Job Board: http://jobs.nodejs.org/ > Posting guidelines: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > You received this message because you are subscribed to the Google > Groups "nodejs" group. > To post to this group, send email to [email protected] <javascript:> > To unsubscribe from this group, send email to > [email protected] <javascript:> > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en?hl=en > > --- > You received this message because you are subscribed to the Google Groups > "nodejs" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] <javascript:>. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
