An Inadvertent Caching Bug
2015-06-09
Here’s some CoffeeScript I wrote in a fit of refactoring a few months ago. It’s an AngularJS factory that does geolocation and returns a promise. In the heat of some intense copy and pasting, I missed a super important detail. Can you see what it is?
angular.module(‘app’) .factory "geolocation", ($q, $ionicPlatform, $cordovaGeolocation) -> geocode = $q (resolve, reject) -> console.log "hello!" # … return { get: -> return geocode } The detail reared it’s head when Ionic, the mobile framework we use, turned on caching by default in an update.
Read more →