Regardless of having labored on the very advanced Firefox for plenty of years, I am going to at all times love plain outdated console.log
debugging. Logging can present an audit path as occasions occur and textual content you’ll be able to share with others. Do you know that chrome offers monitorEvents
and monitor
so that you could get a log every time an occasion happens or perform known as?
Monitor Occasions
Cross a component and a sequence of occasions to monitorEvents
to get a console log when the occasion occurs:
// Monitor any clicks throughout the window monitorEvents(window, 'click on') // Monitor for keyup and keydown occasions on the physique monitorEvents(doc.physique, ['keyup', 'keydown'])
You possibly can move an array of occasions to hear for a number of occasions. The logged occasion
represents the identical occasion you’d see when you manually known as addEventListener
.
Monitor Perform Calls
The monitor
methodology permits you to hear for calls on a particular perform:
// Outline a pattern perform perform myFn() { } // Monitor it monitor(myFn) // Utilization 1: Primary name myFn() // perform myFn known as // Utilization 2: Arguments myFn(1) // perform myFn known as with arguments: 1
I actually like that you may view the arguments offered, which is nice for inspecting.
I often go for logpoints as an alternative of embedding console
statements in code, however monitor
and monitorEvents
present an alternative choice to each.
Introducing MooTools Templated
One main drawback with creating UI parts with the MooTools JavaScript framework is that there is not an effective way of permitting customization of template and ease of node creation. As of at this time, there are two methods of making: new Aspect Insanity The primary method to create UI-driven…
CSS Animations Between Media Queries
CSS animations are proper up there with sliced bread. CSS animations are environment friendly as a result of they are often {hardware} accelerated, they require no JavaScript overhead, and they’re composed of little or no CSS code. Very often we add CSS transforms to parts through CSS throughout…
Spyjax: Ajax For Evil Utilizing Dojo
The concept of Spyjax is nothing new. In pasts posts I’ve lined how one can spy in your person’s historical past with each MooTools and jQuery. Immediately we’ll cowl how one can verify person historical past utilizing the Dojo Toolkit. The HTML For the sake of this…
HTML5 Placeholder Styling with CSS
Final week I confirmed you ways you may type chosen textual content with CSS. I’ve looked for extra fascinating CSS type properties and located one other:
INPUT
placeholder styling. Let me present you how one can type placeholder textual content insideINPUT
parts with some distinctive CSS code. The CSS Firefox…
Source link