Sunday, April 1, 2012

Getting results with Singly's "Build An App!"


The Singly (AKA LockerProject) approach to building an app is pretty simple, but the current instructions didn't work for me locally.  (You can see the instructions after logging in to singly.com and then going to the "Build An App!" page.)  The difficulty may be that I used my index.html incorrectly, but it was the best I could guess: I simply accessed it directly with a "file:///..." URL.  (If anyone knows a better place, I'd love to know; I tried putting it in a separate webserver I've got locally, to no avail.)  I can get this to work, but it requires some tweaking.

The symptom in Firefox was a blank page, and in the Javascript console there was an error: "Operation is not supported" on a line with sessionStorage.  I found that sessionStorage won't work for local ("file") URLs (thanks to this StackOverflow post).

So I changed the references in the api.js to localStorage and things worked for me.  Here is my version: https://github.com/trentlarson/singly-relaxing/blob/5e9cf2c1801b78c130cdc79e84a4cdbf2b3b2deb/singly-api-local.js

It uses a conditional, so I'm hoping it can be used at singly.com as a patch to the default version.

No comments: