Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
jio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Hamza
jio
Commits
598490f5
Commit
598490f5
authored
Jan 10, 2013
by
Sven Franck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jslint pass activityUpdater.js
parent
282d28d5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
67 deletions
+68
-67
src/jio/activityUpdater.js
src/jio/activityUpdater.js
+68
-67
No files found.
src/jio/activityUpdater.js
View file @
598490f5
var
activityUpdater
=
(
function
(
spec
,
my
)
{
/*jslint indent: 2, maxlen: 80, sloppy: true */
var
that
=
{};
/*global localstorage: true, setInterval: true, clearInterval: true */
var
activityUpdater
=
(
function
(
spec
,
my
)
{
var
that
=
{},
priv
=
{};
spec
=
spec
||
{};
spec
=
spec
||
{};
my
=
my
||
{};
my
=
my
||
{};
// Attributes //
var
priv
=
{};
priv
.
id
=
spec
.
id
||
0
;
priv
.
id
=
spec
.
id
||
0
;
priv
.
interval
=
400
;
priv
.
interval
=
400
;
priv
.
interval_id
=
null
;
priv
.
interval_id
=
null
;
...
@@ -13,8 +14,8 @@ var activityUpdater = (function(spec, my) {
...
@@ -13,8 +14,8 @@ var activityUpdater = (function(spec, my) {
* Update the last activity date in the localStorage.
* Update the last activity date in the localStorage.
* @method touch
* @method touch
*/
*/
priv
.
touch
=
function
()
{
priv
.
touch
=
function
()
{
localstorage
.
setItem
(
'
jio/id/
'
+
priv
.
id
,
Date
.
now
());
localstorage
.
setItem
(
'
jio/id/
'
+
priv
.
id
,
Date
.
now
());
};
};
/**
/**
...
@@ -22,7 +23,7 @@ var activityUpdater = (function(spec, my) {
...
@@ -22,7 +23,7 @@ var activityUpdater = (function(spec, my) {
* @method setId
* @method setId
* @param {number} id The jio id.
* @param {number} id The jio id.
*/
*/
that
.
setId
=
function
(
id
)
{
that
.
setId
=
function
(
id
)
{
priv
.
id
=
id
;
priv
.
id
=
id
;
};
};
...
@@ -31,7 +32,7 @@ var activityUpdater = (function(spec, my) {
...
@@ -31,7 +32,7 @@ var activityUpdater = (function(spec, my) {
* @method setIntervalDelay
* @method setIntervalDelay
* @param {number} ms In milliseconds
* @param {number} ms In milliseconds
*/
*/
that
.
setIntervalDelay
=
function
(
ms
)
{
that
.
setIntervalDelay
=
function
(
ms
)
{
priv
.
interval
=
ms
;
priv
.
interval
=
ms
;
};
};
...
@@ -40,7 +41,7 @@ var activityUpdater = (function(spec, my) {
...
@@ -40,7 +41,7 @@ var activityUpdater = (function(spec, my) {
* @method getIntervalDelay
* @method getIntervalDelay
* @return {number} The interval delay.
* @return {number} The interval delay.
*/
*/
that
.
getIntervalDelay
=
function
()
{
that
.
getIntervalDelay
=
function
()
{
return
priv
.
interval
;
return
priv
.
interval
;
};
};
...
@@ -50,10 +51,10 @@ var activityUpdater = (function(spec, my) {
...
@@ -50,10 +51,10 @@ var activityUpdater = (function(spec, my) {
* is active.
* is active.
* @method start
* @method start
*/
*/
that
.
start
=
function
()
{
that
.
start
=
function
()
{
if
(
!
priv
.
interval_id
)
{
if
(
!
priv
.
interval_id
)
{
priv
.
touch
();
priv
.
touch
();
priv
.
interval_id
=
setInterval
(
function
()
{
priv
.
interval_id
=
setInterval
(
function
()
{
priv
.
touch
();
priv
.
touch
();
},
priv
.
interval
);
},
priv
.
interval
);
}
}
...
@@ -63,7 +64,7 @@ var activityUpdater = (function(spec, my) {
...
@@ -63,7 +64,7 @@ var activityUpdater = (function(spec, my) {
* Stops the activity updater.
* Stops the activity updater.
* @method stop
* @method stop
*/
*/
that
.
stop
=
function
()
{
that
.
stop
=
function
()
{
if
(
priv
.
interval_id
!==
null
)
{
if
(
priv
.
interval_id
!==
null
)
{
clearInterval
(
priv
.
interval_id
);
clearInterval
(
priv
.
interval_id
);
priv
.
interval_id
=
null
;
priv
.
interval_id
=
null
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment