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
Alexandra Rogova
jio
Commits
77c358d7
Commit
77c358d7
authored
Oct 03, 2013
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
localstorage description creator redesigned
parent
1a665c10
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
11 deletions
+35
-11
src/jio.storage/localstorage.js
src/jio.storage/localstorage.js
+35
-11
No files found.
src/jio.storage/localstorage.js
View file @
77c358d7
...
@@ -671,26 +671,49 @@
...
@@ -671,26 +671,49 @@
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
// Tools
// Tools
function
createLocalDescription
(
username
,
application_name
)
{
if
(
typeof
username
!==
'
string
'
)
{
throw
new
TypeError
(
"
LocalStorage username must be a string
"
);
}
var
description
=
{
"
type
"
:
"
local
"
,
"
username
"
:
username
};
if
(
typeof
application_name
===
'
string
'
)
{
description
.
application_name
=
application_name
;
}
return
description
;
}
function
createMemoryDescription
(
username
,
application_name
)
{
var
description
=
createLocalDescription
(
username
,
application_name
);
description
.
mode
=
"
memory
"
;
return
description
;
}
/**
/**
* Tool to help users to create local storage description for JIO
* Tool to help users to create local storage description for JIO
*
*
* @param {String} username The username
* @param {String} username The username
* @param {String} [application_name] The application_name
* @param {String} [application_name] The application_name
* @param {String} [mode="localStorage"] Use localStorage or memory
* @return {Object} The storage description
* @return {Object} The storage description
*/
*/
function
createDescription
(
username
,
application_name
)
{
function
createDescription
(
username
,
application_name
,
mode
)
{
var
description
=
{
if
(
mode
===
undefined
||
mode
.
toString
()
===
'
localStorage
'
)
{
"
type
"
:
"
local
"
,
return
createLocalDescription
(
username
,
application_name
);
"
username
"
:
username
.
toString
()
};
if
(
application_name
!==
undefined
)
{
description
.
application_name
=
application_name
.
toString
();
}
}
return
description
;
if
(
mode
.
toString
()
===
'
memory
'
)
{
return
createMemoryDescription
(
username
,
application_name
);
}
throw
new
TypeError
(
"
Unknown LocalStorage '
"
+
mode
.
toString
()
+
"
' mode
"
);
}
}
exports
.
createDescription
=
createDescription
;
exports
.
createDescription
=
createDescription
;
exports
.
createLocalDescription
=
createLocalDescription
;
exports
.
createMemoryDescription
=
createMemoryDescription
;
function
clear
()
{
function
clear
LocalStorage
()
{
var
k
;
var
k
;
for
(
k
in
localStorage
)
{
for
(
k
in
localStorage
)
{
if
(
localStorage
.
hasOwnProperty
(
k
))
{
if
(
localStorage
.
hasOwnProperty
(
k
))
{
...
@@ -700,12 +723,13 @@
...
@@ -700,12 +723,13 @@
}
}
}
}
}
}
exports
.
clear
=
clear
;
exports
.
clearLocalStorage
=
clear
;
function
clearMemoryStorage
()
{
function
clearMemoryStorage
()
{
jIO
.
util
.
dictClear
(
ram
);
jIO
.
util
.
dictClear
(
ram
);
}
}
exports
.
clear
=
clearLocalStorage
;
exports
.
clearLocalStorage
=
clearLocalStorage
;
exports
.
clearMemoryStorage
=
clearMemoryStorage
;
exports
.
clearMemoryStorage
=
clearMemoryStorage
;
}));
}));
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