Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
renderjs
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
renderjs
Commits
cb263573
Commit
cb263573
authored
Nov 14, 2012
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
We need to explicitly call bind.
Catch events only once. Remove dead code. Simplify addGadget.
parent
ccf13197
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
20 deletions
+4
-20
renderjs.js
renderjs.js
+2
-18
test/renderjs_test.js
test/renderjs_test.js
+2
-2
No files found.
renderjs.js
View file @
cb263573
...
...
@@ -14,13 +14,6 @@ var RENDERJS_ENABLE_IMPLICIT_GADGET_RENDERING = true;
// available
var
RENDERJS_ENABLE_IMPLICIT_INTERACTION_BIND
=
true
;
if
(
typeof
require
!==
'
undefined
'
)
{
// XXX: think how to use requirejs to load jquery upfront (and if it's possible)
// example of how we can use requirejs to load external libraries
//require(["../../../../lib/jstorage/jstorage.js"], function (util) {
//});
}
// fallback for IE
if
(
typeof
console
===
"
undefined
"
||
typeof
console
.
log
===
"
undefined
"
)
{
console
=
{};
...
...
@@ -262,18 +255,9 @@ var RenderJs = (function () {
tab_container
.
append
(
html_string
);
tab_gadget
=
tab_container
.
find
(
"
.gadget
"
);
// render new gadget
RenderJs
.
setReady
(
false
);
RenderJs
.
loadGadgetFromUrl
(
tab_gadget
);
// clear previous events
RenderJs
.
GadgetIndex
.
getRootGadget
().
getDom
().
bind
(
"
ready
"
,
function
()
{
if
(
!
is_ready
)
{
RenderJs
.
updateGadgetData
(
tab_gadget
);
is_ready
=
true
;
}
}
);
// this will make RenderJs fire "ready" event when all gadgets are loaded.
RenderJs
.
setReady
(
false
);
return
tab_gadget
;
},
...
...
test/renderjs_test.js
View file @
cb263573
...
...
@@ -81,10 +81,9 @@ function setupRenderJSTest(){
stop
();
// we need to wait for all gadgets loading ...
RenderJs
.
GadgetIndex
.
getRootGadget
().
getDom
().
bind
(
"
ready
"
,
function
()
{
RenderJs
.
GadgetIndex
.
getRootGadget
().
getDom
().
one
(
"
ready
"
,
function
()
{
start
();
equal
(
true
,
RenderJs
.
GadgetIndex
.
isGadgetListLoaded
());
equal
(
true
,
RenderJs
.
isReady
());
});
});
...
...
@@ -96,6 +95,7 @@ function setupRenderJSTest(){
// we need to wait for all gadgets loading ...
RenderJs
.
GadgetIndex
.
getRootGadget
().
getDom
().
bind
(
"
ready
"
,
function
()
{
RenderJs
.
InteractionGadget
.
bind
(
$
(
"
#main-interactor
"
));
start
();
equal
(
0
,
counter
);
// A.inc will call B.inc, both will increase counter by 1
...
...
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