Small improvements

UMD Support.
Move use strict to closure.
Switch from setTimeout to Angular's $timeout .
Add try-catch block for choosing storage type.
Cache length in for-loop.