Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
officejs
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
officejs
Commits
c72fbd99
Commit
c72fbd99
authored
Sep 05, 2012
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove dependency on jStorage for RenderJs and use directly localStorage.
Add documentation link.
parent
e2f63b29
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
12 deletions
+20
-12
OfficeJS/src/renderjs/renderjs.js
OfficeJS/src/renderjs/renderjs.js
+17
-11
OfficeJS/src/renderjs/test/renderjs_test.js
OfficeJS/src/renderjs/test/renderjs_test.js
+3
-1
No files found.
OfficeJS/src/renderjs/renderjs.js
View file @
c72fbd99
/*global console, require, $, localStorage, document */
/*global console, require, $, localStorage, document */
/*
* RenderJs - Generic Gadget library renderer.
* http://www.renderjs.org/documentation
*/
// by default RenderJs will render all gadgets when page is loaded
// by default RenderJs will render all gadgets when page is loaded
// still it's possible to override this and use explicit gadget rendering
// still it's possible to override this and use explicit gadget rendering
var
RENDERJS_ENABLE_IMPLICIT_GADGET_RENDERING
=
true
;
var
RENDERJS_ENABLE_IMPLICIT_GADGET_RENDERING
=
true
;
// Add required by RenderJs jstorage library only if used HTML application
// uses requirejs
if
(
typeof
require
!==
'
undefined
'
)
{
if
(
typeof
require
!==
'
undefined
'
)
{
require
([
"
../../../../lib/jstorage/jstorage.js
"
],
function
(
util
)
{
// example of how we can use requirejs to load external libraries
});
//require(["../../../../lib/jstorage/jstorage.js"], function (util) {
//});
}
}
// fallback for IE
// fallback for IE
...
@@ -17,9 +21,6 @@ if (typeof console === "undefined" || typeof console.log === "undefined") {
...
@@ -17,9 +21,6 @@ if (typeof console === "undefined" || typeof console.log === "undefined") {
console
.
log
=
function
()
{};
console
.
log
=
function
()
{};
}
}
/*
* Generic Gadget library renderer
*/
var
RenderJs
=
(
function
()
{
var
RenderJs
=
(
function
()
{
// a variable indicating if current gadget loading is over or not
// a variable indicating if current gadget loading is over or not
var
is_ready
=
false
;
var
is_ready
=
false
;
...
@@ -281,12 +282,17 @@ var RenderJs = (function () {
...
@@ -281,12 +282,17 @@ var RenderJs = (function () {
return
{
return
{
get
:
function
(
cache_id
,
default_value
)
{
get
:
function
(
cache_id
,
default_value
)
{
/* Get cache key value */
/* Get cache key value */
return
$
.
jStorage
.
get
(
cache_id
,
default_value
);
if
(
cache_id
in
localStorage
)
{
return
JSON
.
parse
(
localStorage
.
getItem
(
cache_id
));
}
else
{
return
default_value
;
}
},
},
set
:
function
(
cache_id
,
data
)
{
set
:
function
(
cache_id
,
data
)
{
/* Set cache key value */
/* Set cache key value */
$
.
jStorage
.
set
(
cache_id
,
data
);
localStorage
.
setItem
(
cache_id
,
JSON
.
stringify
(
data
)
);
}
}
};
};
}()),
}()),
...
...
OfficeJS/src/renderjs/test/renderjs_test.js
View file @
c72fbd99
...
@@ -23,6 +23,8 @@ function setupRenderJSTest(){
...
@@ -23,6 +23,8 @@ function setupRenderJSTest(){
data
=
{
'
gg
'
:
1
};
data
=
{
'
gg
'
:
1
};
RenderJs
.
Cache
.
set
(
cache_id
,
data
);
RenderJs
.
Cache
.
set
(
cache_id
,
data
);
deepEqual
(
data
,
RenderJs
.
Cache
.
get
(
cache_id
));
deepEqual
(
data
,
RenderJs
.
Cache
.
get
(
cache_id
));
// test return default value if key is missing works
equal
(
"
no such key
"
,
RenderJs
.
Cache
.
get
(
"
no_such_key
"
,
"
no such key
"
));
});
});
module
(
"
GadgetIndex
"
);
module
(
"
GadgetIndex
"
);
...
...
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