Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
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
Vincent Bechu
jio
Commits
9a721175
Commit
9a721175
authored
Sep 20, 2017
by
Vincent Bechu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[dateupdaterstorage] Init this storage
parent
6e6b73b9
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
659 additions
and
0 deletions
+659
-0
src/jio.storage/dateupdaterstorage.js
src/jio.storage/dateupdaterstorage.js
+84
-0
test/jio.storage/dateupdaterstorage.tests.js
test/jio.storage/dateupdaterstorage.tests.js
+575
-0
No files found.
src/jio.storage/dateupdaterstorage.js
0 → 100644
View file @
9a721175
/*jslint nomen: true*/
(
function
(
jIO
)
{
"
use strict
"
;
/**
* The jIO DateUpdaterStorage extension
*
* @class DateUpdaterStorage
* @constructor
*/
function
updateDocument
(
doc
,
property_list
)
{
var
i
,
len
=
property_list
.
length
;
for
(
i
=
0
;
i
<
len
;
i
+=
1
)
{
doc
[
property_list
[
i
]]
=
new
Date
().
toUTCString
().
replace
(
'
GMT
'
,
'
+0000
'
);
}
return
doc
;
}
function
DateUpdaterStorage
(
spec
)
{
this
.
_sub_storage
=
jIO
.
createJIO
(
spec
.
sub_storage
);
this
.
_property_list
=
spec
.
property_list
||
[];
}
DateUpdaterStorage
.
prototype
.
get
=
function
()
{
return
this
.
_sub_storage
.
get
.
apply
(
this
.
_sub_storage
,
arguments
);
};
DateUpdaterStorage
.
prototype
.
allAttachments
=
function
()
{
return
this
.
_sub_storage
.
allAttachments
.
apply
(
this
.
_sub_storage
,
arguments
);
};
DateUpdaterStorage
.
prototype
.
post
=
function
(
doc
)
{
doc
=
updateDocument
(
doc
,
this
.
_property_list
);
return
this
.
_sub_storage
.
post
(
doc
);
};
DateUpdaterStorage
.
prototype
.
put
=
function
(
id
,
doc
)
{
doc
=
updateDocument
(
doc
,
this
.
_property_list
);
return
this
.
_sub_storage
.
put
(
id
,
doc
);
};
DateUpdaterStorage
.
prototype
.
remove
=
function
()
{
return
this
.
_sub_storage
.
remove
.
apply
(
this
.
_sub_storage
,
arguments
);
};
DateUpdaterStorage
.
prototype
.
getAttachment
=
function
()
{
return
this
.
_sub_storage
.
getAttachment
.
apply
(
this
.
_sub_storage
,
arguments
);
};
DateUpdaterStorage
.
prototype
.
putAttachment
=
function
(
id
)
{
var
storage
=
this
,
argument_list
=
arguments
;
return
storage
.
get
(
id
)
.
push
(
function
(
doc
)
{
return
storage
.
put
(
id
,
doc
);
})
.
push
(
function
()
{
return
storage
.
_sub_storage
.
putAttachment
.
apply
(
storage
.
_sub_storage
,
argument_list
);
});
};
DateUpdaterStorage
.
prototype
.
removeAttachment
=
function
(
id
)
{
var
storage
=
this
,
argument_list
=
arguments
;
return
storage
.
get
(
id
)
.
push
(
function
(
doc
)
{
return
storage
.
put
(
id
,
doc
);
})
.
push
(
function
()
{
return
storage
.
_sub_storage
.
removeAttachment
.
apply
(
storage
.
_sub_storage
,
argument_list
);
});
};
DateUpdaterStorage
.
prototype
.
repair
=
function
()
{
return
this
.
_sub_storage
.
repair
.
apply
(
this
.
_sub_storage
,
arguments
);
};
DateUpdaterStorage
.
prototype
.
hasCapacity
=
function
(
name
)
{
return
this
.
_sub_storage
.
hasCapacity
(
name
);
};
DateUpdaterStorage
.
prototype
.
buildQuery
=
function
()
{
return
this
.
_sub_storage
.
buildQuery
.
apply
(
this
.
_sub_storage
,
arguments
);
};
jIO
.
addStorage
(
'
dateupdater
'
,
DateUpdaterStorage
);
}(
jIO
));
test/jio.storage/dateupdaterstorage.tests.js
0 → 100644
View file @
9a721175
This diff is collapsed.
Click to expand it.
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