Commit 4ef47e26 authored by Ivan Tyagov's avatar Ivan Tyagov

Implicitly call "bind" on all Interaction Gadgets found in page.

Add a configuration variable that can turn this feature on / off
(default on).
parent 8d920295
......@@ -26,15 +26,6 @@
{"source": "B.jsCall2", "destination": "A.jsCall2"}]">
</div>
<script type="text/javascript" language="javascript">
//<![CDATA[
$(document).ready(function() {
RenderJs.GadgetIndex.getRootGadget().getDom().bind("ready", function () {
RenderJs.InteractionGadget.bind($("#main-interactor"));});
});
//]]>
</script>
</body>
</html>
......
......@@ -10,6 +10,10 @@
// still it's possible to override this and use explicit gadget rendering
var RENDERJS_ENABLE_IMPLICIT_GADGET_RENDERING = true;
// by default RenderJs will examin and bind all interaction gadgets
// available
var RENDERJS_ENABLE_IMPLICIT_INTERACTION_BIND = true;
if (typeof require !== 'undefined') {
// example of how we can use requirejs to load external libraries
//require(["../../../../lib/jstorage/jstorage.js"], function (util) {
......@@ -544,4 +548,14 @@ $(document).ready(function () {
if (RENDERJS_ENABLE_IMPLICIT_GADGET_RENDERING) {
RenderJs.bootstrap($('body'));
}
if (RENDERJS_ENABLE_IMPLICIT_INTERACTION_BIND) {
RenderJs.GadgetIndex.getRootGadget().getDom().bind("ready",
function () {
// examine all Intaction Gadgets and bind accordingly
$("div[data-gadget-connection]").each( function(index, element) {
RenderJs.InteractionGadget.bind($(element));
})
}
);
}
});
......@@ -2,6 +2,9 @@
* RenderJs tests
*/
counter = 0;
// in tests we need to call function manually rather than rely
// on implicit calling
RENDERJS_ENABLE_IMPLICIT_INTERACTION_BIND=false;
function cleanUp () {
/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment