Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jio-main
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
Hardik Juneja
jio-main
Commits
effc66a8
Commit
effc66a8
authored
Aug 06, 2013
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
localstorage.js amd compatible now
parent
b56a8a06
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
373 additions
and
355 deletions
+373
-355
src/jio.storage/localstorage.js
src/jio.storage/localstorage.js
+373
-355
No files found.
src/jio.storage/localstorage.js
View file @
effc66a8
/*
/*
* Copyright 2013, Nexedi SA
* Copyright 2013, Nexedi SA
* Released under the LGPL license.
* Released under the LGPL license.
* http://www.gnu.org/licenses/lgpl.html
* http://www.gnu.org/licenses/lgpl.html
*/
*/
/*jslint indent: 2, maxlen: 80, sloppy: true, nomen: true */
/*jslint indent: 2, maxlen: 80, sloppy: true, nomen: true */
/*global jIO: true, localStorage: true, setTimeout: true,
/*global jIO: true, localStorage: true, setTimeout: true,
complex_queries
: tru
e */
complex_queries
, defin
e */
/**
/**
* JIO Local Storage. Type = 'local'.
* JIO Local Storage. Type = 'local'.
...
@@ -43,7 +43,18 @@
...
@@ -43,7 +43,18 @@
*
*
* @class LocalStorage
* @class LocalStorage
*/
*/
jIO
.
addStorageType
(
'
local
'
,
function
(
spec
,
my
)
{
// define([module_name], [dependencies], module);
(
function
(
dependencies
,
module
)
{
"
use strict
"
;
if
(
typeof
define
===
'
function
'
&&
define
.
amd
)
{
return
define
(
dependencies
,
module
);
}
module
(
jIO
,
complex_queries
);
}([
'
jio
'
,
'
complex_queries
'
],
function
(
jIO
,
complex_queries
)
{
"
use strict
"
;
jIO
.
addStorageType
(
'
local
'
,
function
(
spec
,
my
)
{
spec
=
spec
||
{};
spec
=
spec
||
{};
var
that
,
priv
,
localstorage
;
var
that
,
priv
,
localstorage
;
...
@@ -240,7 +251,9 @@ jIO.addStorageType('local', function (spec, my) {
...
@@ -240,7 +251,9 @@ jIO.addStorageType('local', function (spec, my) {
*/
*/
that
.
get
=
function
(
command
)
{
that
.
get
=
function
(
command
)
{
setTimeout
(
function
()
{
setTimeout
(
function
()
{
var
doc
=
localstorage
.
getItem
(
priv
.
localpath
+
"
/
"
+
command
.
getDocId
());
var
doc
=
localstorage
.
getItem
(
priv
.
localpath
+
"
/
"
+
command
.
getDocId
()
);
if
(
doc
!==
null
)
{
if
(
doc
!==
null
)
{
that
.
success
(
doc
);
that
.
success
(
doc
);
}
else
{
}
else
{
...
@@ -262,8 +275,10 @@ jIO.addStorageType('local', function (spec, my) {
...
@@ -262,8 +275,10 @@ jIO.addStorageType('local', function (spec, my) {
*/
*/
that
.
getAttachment
=
function
(
command
)
{
that
.
getAttachment
=
function
(
command
)
{
setTimeout
(
function
()
{
setTimeout
(
function
()
{
var
doc
=
localstorage
.
getItem
(
priv
.
localpath
+
"
/
"
+
command
.
getDocId
()
+
var
doc
=
localstorage
.
getItem
(
"
/
"
+
command
.
getAttachmentId
());
priv
.
localpath
+
"
/
"
+
command
.
getDocId
()
+
"
/
"
+
command
.
getAttachmentId
()
);
if
(
doc
!==
null
)
{
if
(
doc
!==
null
)
{
that
.
success
(
doc
);
that
.
success
(
doc
);
}
else
{
}
else
{
...
@@ -370,7 +385,9 @@ jIO.addStorageType('local', function (spec, my) {
...
@@ -370,7 +385,9 @@ jIO.addStorageType('local', function (spec, my) {
* @param {object} command The JIO command
* @param {object} command The JIO command
*/
*/
that
.
allDocs
=
function
(
command
)
{
that
.
allDocs
=
function
(
command
)
{
var
i
,
row
,
path_re
,
rows
=
[],
document_list
=
[],
option
,
document_object
;
var
i
,
row
,
path_re
,
rows
,
document_list
,
option
,
document_object
;
rows
=
[];
document_list
=
[];
path_re
=
new
RegExp
(
path_re
=
new
RegExp
(
"
^
"
+
complex_queries
.
stringEscapeRegexpCharacters
(
priv
.
localpath
)
+
"
^
"
+
complex_queries
.
stringEscapeRegexpCharacters
(
priv
.
localpath
)
+
"
/[^/]+$
"
"
/[^/]+$
"
...
@@ -434,4 +451,5 @@ jIO.addStorageType('local', function (spec, my) {
...
@@ -434,4 +451,5 @@ jIO.addStorageType('local', function (spec, my) {
};
};
return
that
;
return
that
;
});
});
}));
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