Regardless of having labored on the very complicated Firefox for various years, I will at all times love plain outdated console.log
debugging. Logging can present an audit path as occasions occur and textual content you may share with others. Do you know that chrome gives monitorEvents
and monitor
in an effort to get a log every time an occasion happens or operate known as?
Monitor Occasions
Go a component and a sequence of occasions to monitorEvents
to get a console log when the occasion occurs:
// Monitor any clicks inside the window monitorEvents(window, 'click on') // Monitor for keyup and keydown occasions on the physique monitorEvents(doc.physique, ['keyup', 'keydown'])
You’ll be able to move an array of occasions to hear for a number of occasions. The logged occasion
represents the identical occasion you’d see in case you manually known as addEventListener
.
Monitor Operate Calls
The monitor
methodology means that you can hear for calls on a particular operate:
// Outline a pattern operate operate myFn() { } // Monitor it monitor(myFn) // Utilization 1: Primary name myFn() // operate myFn known as // Utilization 2: Arguments myFn(1) // operate myFn known as with arguments: 1
I actually like you can view the arguments supplied, which is nice for inspecting.
I often go for logpoints as a substitute of embedding console
statements in code, however monitor
and monitorEvents
present a substitute for each.
CSS Gradients
With CSS border-radius, I confirmed you the way CSS can bridge the hole between design and improvement by including rounded corners to parts. CSS gradients are one other step in that course. Now that CSS gradients are supported in Web Explorer 8+, Firefox, Safari, and Chrome…
Digital camera and Video Management with HTML5
Consumer-side APIs on cell and desktop gadgets are shortly offering the identical APIs. In fact our cell gadgets obtained entry to a few of these APIs first, however these APIs are slowly making their approach to the desktop. A type of APIs is the getUserMedia API…
Chris Coyier’s Favourite CodePen Demos II
Hey everybody! Earlier than we get began, I simply wish to say it is rattling exhausting to choose this few favorites on CodePen. Not as a result of, as a co-founder of CodePen, I really feel like a dad selecting which child he likes finest (RUDE). However as a result of there’s simply so…