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
Ivan Tyagov
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
Hide 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;
...
@@ -14,13 +14,6 @@ var RENDERJS_ENABLE_IMPLICIT_GADGET_RENDERING = true;
// available
// available
var
RENDERJS_ENABLE_IMPLICIT_INTERACTION_BIND
=
true
;
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
// fallback for IE
if
(
typeof
console
===
"
undefined
"
||
typeof
console
.
log
===
"
undefined
"
)
{
if
(
typeof
console
===
"
undefined
"
||
typeof
console
.
log
===
"
undefined
"
)
{
console
=
{};
console
=
{};
...
@@ -262,18 +255,9 @@ var RenderJs = (function () {
...
@@ -262,18 +255,9 @@ var RenderJs = (function () {
tab_container
.
append
(
html_string
);
tab_container
.
append
(
html_string
);
tab_gadget
=
tab_container
.
find
(
"
.gadget
"
);
tab_gadget
=
tab_container
.
find
(
"
.gadget
"
);
// render new gadget
// render new gadget
RenderJs
.
setReady
(
false
);
RenderJs
.
loadGadgetFromUrl
(
tab_gadget
);
RenderJs
.
loadGadgetFromUrl
(
tab_gadget
);
// clear previous events
// this will make RenderJs fire "ready" event when all gadgets are loaded.
RenderJs
.
GadgetIndex
.
getRootGadget
().
getDom
().
bind
(
RenderJs
.
setReady
(
false
);
"
ready
"
,
function
()
{
if
(
!
is_ready
)
{
RenderJs
.
updateGadgetData
(
tab_gadget
);
is_ready
=
true
;
}
}
);
return
tab_gadget
;
return
tab_gadget
;
},
},
...
...
test/renderjs_test.js
View file @
cb263573
...
@@ -81,10 +81,9 @@ function setupRenderJSTest(){
...
@@ -81,10 +81,9 @@ function setupRenderJSTest(){
stop
();
stop
();
// we need to wait for all gadgets loading ...
// we need to wait for all gadgets loading ...
RenderJs
.
GadgetIndex
.
getRootGadget
().
getDom
().
bind
(
"
ready
"
,
function
()
{
RenderJs
.
GadgetIndex
.
getRootGadget
().
getDom
().
one
(
"
ready
"
,
function
()
{
start
();
start
();
equal
(
true
,
RenderJs
.
GadgetIndex
.
isGadgetListLoaded
());
equal
(
true
,
RenderJs
.
GadgetIndex
.
isGadgetListLoaded
());
equal
(
true
,
RenderJs
.
isReady
());
});
});
});
});
...
@@ -96,6 +95,7 @@ function setupRenderJSTest(){
...
@@ -96,6 +95,7 @@ function setupRenderJSTest(){
// we need to wait for all gadgets loading ...
// we need to wait for all gadgets loading ...
RenderJs
.
GadgetIndex
.
getRootGadget
().
getDom
().
bind
(
"
ready
"
,
function
()
{
RenderJs
.
GadgetIndex
.
getRootGadget
().
getDom
().
bind
(
"
ready
"
,
function
()
{
RenderJs
.
InteractionGadget
.
bind
(
$
(
"
#main-interactor
"
));
start
();
start
();
equal
(
0
,
counter
);
equal
(
0
,
counter
);
// A.inc will call B.inc, both will increase counter by 1
// 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