We all need access to the local storage every once in a while.
Usually it’s for locally storing state variables or data retrieved from the server that does not change throughout the life of the application.
It can save up some loading time on subsequent executions as well as reduce server load.
Month: May 2014
Components development – FIRST
A great post by Addy Osmani on how to build components that are Focused, Independent, Reusable, Small & Testable.
In short – FIRST.
Go read the post here. Well worth a few minutes 🙂
Jasmine tests – expect().toThrow()
Suppose you have a service that you want to test.
And let’s also suppose that this service has a method that throws an Error under some scenario.
How would you test this?
$watch invoked multiple times, what gives?
So, you have a variable on your $scope and you want to know when it’s value is modified.
Pretty straight forward stuff right?
You write a $scope.$watch, give it a handler and you’re done, right?
Timing service
Every once in a while, I find myself in need of a timing mechanism. Something that will handle timing and scheduling, and allow me to hook with a custom functionality every interval.
Some uses can be, for example, a clock counting down or simply showing the time passing by, polling the server back-end for new data, etc. Basically, anything that needs to happen every given interval.