Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
renderjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
renderjs
Commits
8d5df8ca
Commit
8d5df8ca
authored
Oct 02, 2012
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a shorthand way to bind to Gadgets' ready event.
Use for this internally root dom element.
parent
4c1b743d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
8 deletions
+17
-8
renderjs.js
renderjs.js
+17
-8
No files found.
renderjs.js
View file @
8d5df8ca
...
...
@@ -149,6 +149,13 @@ var RenderJs = (function () {
is_ready
=
value
;
},
bindReady
:
function
(
ready_function
)
{
/*
* Bind a function on ready gadget loading.
*/
$
(
"
body
"
).
one
(
"
ready
"
,
ready_function
);
},
checkAndTriggerReady
:
function
()
{
/*
* Trigger "ready" event only if all gadgets were marked as "ready"
...
...
@@ -157,8 +164,11 @@ var RenderJs = (function () {
is_gadget_list_loaded
=
RenderJs
.
GadgetIndex
.
isGadgetListLoaded
();
if
(
is_gadget_list_loaded
)
{
if
(
!
RenderJs
.
isReady
())
{
// backwards compatability with already written code
RenderJs
.
GadgetIndex
.
getRootGadget
().
getDom
().
trigger
(
"
ready
"
);
// trigger ready on root body element
$
(
"
body
"
).
trigger
(
"
ready
"
);
RenderJs
.
setReady
(
true
);
}
}
...
...
@@ -555,14 +565,13 @@ $(document).ready(function () {
// Be careful, right now we can be in this case because
// asynchronous gadget loading is not finished
if
(
root_gadget
!==
undefined
)
{
root_gadget
.
getDom
().
bind
(
"
ready
"
,
RenderJs
.
bindReady
(
function
()
{
// examine all Intaction Gadgets and bind accordingly
$
(
"
div[data-gadget-connection]
"
).
each
(
function
(
index
,
element
)
{
RenderJs
.
InteractionGadget
.
bind
(
$
(
element
));
})
}
);
});
}
}
});
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