spine / spine

Lightweight MVC library for building JavaScript applications

Home Page:http://spine.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Crashes if the browser doesn't support localStorage

ins429 opened this issue · comments

Crashes if a model is using localStorage and browser doesn't support localStorage.

// from Safari private browsing
QuotaExceededError: DOM Exception 22: An attempt was made to add something to storage that exceeded the quota.

Should extend Spine.Model.Local only If localStorage is supported.

Such line(

extended: ->
@change @saveLocal
@fetch @loadLocal
) should check if the browser supports localStorage:

 extended: ->
    if window.localStorage
        @change @saveLocal
        @fetch @loadLocal