Created
October 4, 2012 21:08
-
-
Save acidsound/3836472 to your computer and use it in GitHub Desktop.
use JSON Object on Meteor.Session
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* getter/setter limit for page */ | |
var getLimit = function (page) { | |
try { | |
pageLimit = JSON.parse(Session.get('limit'))[page]; | |
pageLimit = pageLimit ? pageLimit : DEFAULT_PAGE_LIMIT; | |
return pageLimit; | |
} catch (e) { | |
return DEFAULT_PAGE_LIMIT; | |
} | |
} | |
var setLimit = function (page, limit) { | |
try { | |
pageLimit = JSON.parse(Session.get('limit')); | |
} catch (e) { | |
p = {}; | |
p[page] = limit; | |
Session.set('limit', JSON.stringify(p)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment