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
Kirill Smelkov
jio
Commits
59d01abf
Commit
59d01abf
authored
Jan 10, 2013
by
Sven Franck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jslint pass waitstorage.js
parent
93c5a742
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
68 deletions
+68
-68
src/jio.waitstorage.js
src/jio.waitstorage.js
+68
-68
No files found.
src/jio.waitstorage.js
View file @
59d01abf
/*global window, define */
/*jslint indent: 2, maxlen: 80, sloppy: true */
/*global setTimeout: true, window: true, define: true, jIO: true */
(
function
()
{
'
use strict
'
;
var
jioWaitStorageLoader
=
function
(
jIO
)
{
var
newWaitStorage
=
function
(
spec
,
my
)
{
var
that
=
my
.
basicStorage
(
spec
,
my
),
priv
=
{},
validatestate_sub_storage
=
spec
.
storage
||
false
;
'
use strict
'
;
var
jioWaitStorageLoader
=
function
(
jIO
)
{
var
newWaitStorage
=
function
(
spec
,
my
)
{
var
that
=
my
.
basicStorage
(
spec
,
my
),
priv
=
{},
validatestate_sub_storage
=
spec
.
storage
||
false
;
priv
.
sub_storage_spec
=
spec
.
storage
||
{
type
:
'
base
'
};
priv
.
delay
=
spec
.
delay
||
5000
;
priv
.
save
=
spec
.
save
||
true
;
priv
.
load
=
spec
.
load
||
false
;
priv
.
getlist
=
spec
.
getlist
||
false
;
priv
.
remove
=
spec
.
remove
||
false
;
priv
.
sub_storage_spec
=
spec
.
storage
||
{
type
:
'
base
'
};
priv
.
delay
=
spec
.
delay
||
5000
;
priv
.
save
=
spec
.
save
||
true
;
priv
.
load
=
spec
.
load
||
false
;
priv
.
getlist
=
spec
.
getlist
||
false
;
priv
.
remove
=
spec
.
remove
||
false
;
that
.
validateState
=
function
()
{
if
(
!
validatestate_sub_storage
)
{
return
'
Need at least one parameter: "storage"
'
+
'
containing storage specifications.
'
;
}
return
''
;
};
that
.
validateState
=
function
()
{
if
(
!
validatestate_sub_storage
)
{
return
'
Need at least one parameter: "storage"
'
+
'
containing storage specifications.
'
;
}
return
''
;
};
that
.
specToStore
=
function
()
{
var
o
=
{};
o
.
delay
=
priv
.
delay
;
o
.
storage
=
priv
.
sub_storage_spec
;
o
.
save
=
priv
.
save
;
o
.
load
=
priv
.
load
;
o
.
getlist
=
priv
.
getlist
;
o
.
remove
=
priv
.
remove
;
return
o
;
};
that
.
specToStore
=
function
()
{
var
o
=
{};
o
.
delay
=
priv
.
delay
;
o
.
storage
=
priv
.
sub_storage_spec
;
o
.
save
=
priv
.
save
;
o
.
load
=
priv
.
load
;
o
.
getlist
=
priv
.
getlist
;
o
.
remove
=
priv
.
remove
;
return
o
;
};
priv
.
doJob
=
function
(
command
,
timeout_or_not_timeout
)
{
var
delay
=
0
;
if
(
timeout_or_not_timeout
)
{
delay
=
priv
.
delay
;
}
window
.
setTimeout
(
function
()
{
that
.
addJob
(
that
.
newStorage
(
priv
.
sub_storage_spec
),
command
);
that
.
end
();
},
delay
);
};
priv
.
doJob
=
function
(
command
,
timeout_or_not_timeout
)
{
var
delay
=
0
;
if
(
timeout_or_not_timeout
)
{
delay
=
priv
.
delay
;
}
setTimeout
(
function
()
{
that
.
addJob
(
that
.
newStorage
(
priv
.
sub_storage_spec
),
command
);
that
.
end
();
},
delay
);
};
that
.
saveDocument
=
function
(
command
)
{
priv
.
doJob
(
command
,
priv
.
save
);
};
// end saveDocument
that
.
loadDocument
=
function
(
command
)
{
priv
.
doJob
(
command
,
priv
.
load
);
};
// end loadDocument
that
.
getDocumentList
=
function
(
command
)
{
priv
.
doJob
(
command
,
priv
.
getlist
);
};
// end getDocumentList
that
.
removeDocument
=
function
(
command
)
{
priv
.
doJob
(
command
,
priv
.
remove
);
};
// end removeDocument
return
that
;
};
jIO
.
addStorageType
(
'
wait
'
,
newWaitStorage
);
that
.
saveDocument
=
function
(
command
)
{
priv
.
doJob
(
command
,
priv
.
save
);
};
// end saveDocument
that
.
loadDocument
=
function
(
command
)
{
priv
.
doJob
(
command
,
priv
.
load
);
};
// end loadDocument
that
.
getDocumentList
=
function
(
command
)
{
priv
.
doJob
(
command
,
priv
.
getlist
);
};
// end getDocumentList
that
.
removeDocument
=
function
(
command
)
{
priv
.
doJob
(
command
,
priv
.
remove
);
};
// end removeDocument
return
that
;
};
if
(
window
.
requirejs
)
{
define
(
'
JIOWaitStorages
'
,
[
'
jIO
'
],
jioWaitStorageLoader
);
}
else
{
jioWaitStorageLoader
(
jIO
);
}
jIO
.
addStorageType
(
'
wait
'
,
newWaitStorage
);
};
if
(
window
.
requirejs
)
{
define
(
'
JIOWaitStorages
'
,
[
'
jIO
'
],
jioWaitStorageLoader
);
}
else
{
jioWaitStorageLoader
(
jIO
);
}
}
());
\ No newline at end of file
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