Going insane with undefined property that shouldn’t be


Going insane with undefined property that shouldn’t be

So, I'm console logging the object session and I can see in the console log it has sessionDescriptionHandler property and under that peerConnection.

In the line after I call for:

session.sessionDescriptionHandler.peerConnection.onaddstream = eventHandler

and it gives me the error:

Uncaught TypeError: Cannot read property 'peerConnection' of undefined

HOW IS THIS POSSIBLE I JUST SAW IT IN CONSOLE LOG IT IS THERE FFS I'M GONNA KILL MYSELF

Submitted October 31, 2017 at 10:33PM by fuub0
via reddit http://ift.tt/2A3NA1q

Needle in NPM haystack — instrumentation for metadata lookup calls


Needle in NPM haystack — instrumentation for metadata lookup calls

Scenario: I have a long-running API export script that makes many call outs for meta data lookups. A lot of this work is serialized so I don't overwhelm the related APIs. The script is running slowly and I want to get a sense for what lookups are being the most problematic so I can try to optimize. All the lookup functions are exported in a single module. All functions return promises.

Goal: Periodically (once a minute-ish, should be configurable) output stats for each function including rate, count and average/total time to execute so I can see where the time is being spent. Ideally, this would using a simple npm module somehow to the module to get this functionality without writing it myself.

Anyone have any recommendations?

Submitted October 31, 2017 at 10:45PM by jayjanssen
via reddit http://ift.tt/2lCWkZl