Posts about JavaScript

Error Handling When Chaining Promises

November 23rd 2018 JavaScript

The Promise.catch method is a convenient tool for handling errors anywhere inside the promise chain up to the method call. However, care must still be taken when writing the chained code inside the Promise.then method, otherwise some errors might not be properly handled.

Variable Number of Arguments in TypeScript

February 16th 2018 TypeScript JavaScript

JavaScript has always supported functions with variable number of arguments, although the syntax required some getting used to. In TypeScript and ECMAScript 6 rest parameters and spread syntax provide a more convenient alternative that also works with arrow functions.

Sharing Console Log from Ionic Apps

January 19th 2018 Ionic 2/3 Cordova JavaScript

Logging to browser console can be a useful tool for troubleshooting Ionic applications during development. Although all the logging is still done in test builds, the process of getting the log from the device is not tester-friendly. Without too much effort this experience can be improved a lot by adding an option to export the log directly from the application.

Reporting JavaScript Error Details from Promises

October 27th 2017 JavaScript

Promises make it easy to handle errors in asynchronous method calls. The rejection handler can be used to log full error details from a rejected promise. It will also catch any errors that might happen in the fulfillment handler. However, the Error object details might not get logged as you would expect.

Functional Array Operations in JavaScript

September 22nd 2017 JavaScript TypeScript

JavaScript's Array prototype provides a comprehensive selection of methods which lend themselves nicely to functional programming approach, such as ma and reduce. Surprisingly, when doing code reviews I often see that developers are not aware of them or not used to using them. In this post, I'll do an overview of these functions with examples how they can simplify your code.

Detecting Camera Permission Dialog in Browser

September 1st 2017 HTML 5 JavaScript Web Analytics

When trying to capture camera video from browser using MediaDevices.getUserMedia, user consent is required. On first call the browser will show a dialog to the user who can either allow or block access to the camera. It might be useful to have some analytical data for your application on how many users blocked the camera access, but unfortunately there's no direct way to detect from code when the dialog was shown and how the user answered.

Render Captured Video to Full Page Canvas

March 17th 2017 HTML 5 JavaScript

In modern HTML 5 browsers you can render video from your camera inside a web page using the video element. However, to further process the captured video or add some custom rendering on top of it, the canvas element needs to be used. Due to the ever changing APIs in this field, it's not easy to find up-to-date working sample code for achieving this.

Debugging Karma Tests in a Browser

Having unit tests usually drastically reduces the need for interactive debugging. However, being able to debug unit tests can sometimes prove very useful. Nowadays, any browser includes a fully featured debugger as part of its developer tools, and Karma test runner has a dedicated feature for in-browser debugging. I wrote short instructions on how exactly to use this feature for a project I am working on.

Continuous Testing with Wallaby.js

I first stumbled across wallaby.js while working on my previous articles about continuous testing in the JavaScript ecosystem using Karma. After reading more about it in Scott Hanselman's blog post, I decided to try it out myself.

Continuous Testing of JavaScript Code

Unit testing is a crucial part of development in any language, but its even more important in dynamically typed and interpreted languages such as JavaScript because there's no compiler doing at least basic validation of the code. Just like in .NET development, quick feedback is very valuable, and nothing can beat continuous testing in this field.

Book Review: SignalR Real-time Application Cookbook

If you're looking for a book to learn SignalR from, you can't go wrong with this one. On the other hand, if you're already fluent in SignalR and just want to learn more, it probably isn't your best choice, unless you're interested in one of the above mentioned topics.

Book Review: Mastering JavaScript Design Patterns

This book is a recommended reading not only for JavaScript developers, but also for others who want to refresh or expand their knowledge of design patterns. Learning some JavaScript in the process is just an additional benefit.

Book Review: Developing Windows Store Apps with HTML5 and JavaScript

October 21st 2013 Windows Store JavaScript Review Book

I would recommend this book to anyone with no or minimal knowledge about Windows Store apps, who's interested in developing them using HTML5 and JavaScript, even if he isn't already proficient in them.

Running Windows Sidebar Gadgets Directly in IE7

October 29th 2006 Sidebar Gadgets JavaScript Windows

Since gadgets are HTML applications and the Windows Sidebar uses Internet Explorer 7 to render them, I prefer running their code directly in IE7 during development.

Resources for Windows Sidebar Gadget Development

October 22nd 2006 Sidebar Gadgets JavaScript Windows

I though I'd gather in one place all the useful links I found with information on development of Windows Sidebar gadgets.

A Sample Windows Sidebar Gadget

October 22nd 2006 Sidebar Gadgets JavaScript Windows

I wrote my own sample with clearly separated HTML structure, CSS styles and JavaScript code to showcase development of Windows Sidebar Gadgets.

Writing Your First Windows Sidebar Gadget

October 22nd 2006 Sidebar Gadgets JavaScript Windows

I've gathered few issues that could be covered better in the documentation since I've been struggling with them for some timeĀ before IĀ got everything to work as expected.