Commit 598490f5 authored by Sven Franck's avatar Sven Franck

jslint pass activityUpdater.js

parent 282d28d5
var activityUpdater = (function(spec, my) {
var that = {};
/*jslint indent: 2, maxlen: 80, sloppy: true */
/*global localstorage: true, setInterval: true, clearInterval: true */
var activityUpdater = (function (spec, my) {
var that = {}, priv = {};
spec = spec || {};
my = my || {};
// Attributes //
var priv = {};
priv.id = spec.id || 0;
priv.interval = 400;
priv.interval_id = null;
......@@ -13,8 +14,8 @@ var activityUpdater = (function(spec, my) {
* Update the last activity date in the localStorage.
* @method touch
*/
priv.touch = function() {
localstorage.setItem ('jio/id/'+priv.id, Date.now());
priv.touch = function () {
localstorage.setItem('jio/id/' + priv.id, Date.now());
};
/**
......@@ -22,7 +23,7 @@ var activityUpdater = (function(spec, my) {
* @method setId
* @param {number} id The jio id.
*/
that.setId = function(id) {
that.setId = function (id) {
priv.id = id;
};
......@@ -31,7 +32,7 @@ var activityUpdater = (function(spec, my) {
* @method setIntervalDelay
* @param {number} ms In milliseconds
*/
that.setIntervalDelay = function(ms) {
that.setIntervalDelay = function (ms) {
priv.interval = ms;
};
......@@ -40,7 +41,7 @@ var activityUpdater = (function(spec, my) {
* @method getIntervalDelay
* @return {number} The interval delay.
*/
that.getIntervalDelay = function() {
that.getIntervalDelay = function () {
return priv.interval;
};
......@@ -50,10 +51,10 @@ var activityUpdater = (function(spec, my) {
* is active.
* @method start
*/
that.start = function() {
that.start = function () {
if (!priv.interval_id) {
priv.touch();
priv.interval_id = setInterval(function() {
priv.interval_id = setInterval(function () {
priv.touch();
}, priv.interval);
}
......@@ -63,7 +64,7 @@ var activityUpdater = (function(spec, my) {
* Stops the activity updater.
* @method stop
*/
that.stop = function() {
that.stop = function () {
if (priv.interval_id !== null) {
clearInterval(priv.interval_id);
priv.interval_id = null;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment