Added support for running a function before the draw() function of a widget, for example when a widget needs to fetch additional user informations that aren't provided by the metadatas
authordurandn
Fri, 18 Sep 2015 14:39:45 +0200
changeset 1049 4e8b3df6e5be
parent 1048 13211bca0256
child 1050 0b287ecbc2cb
Added support for running a function before the draw() function of a widget, for example when a widget needs to fetch additional user informations that aren't provided by the metadatas
src/js/widgets-container/widget.js
--- a/src/js/widgets-container/widget.js	Fri Sep 18 14:32:28 2015 +0200
+++ b/src/js/widgets-container/widget.js	Fri Sep 18 14:39:45 2015 +0200
@@ -77,7 +77,13 @@
                 _this.media = _this.source.getCurrentMedia(_mediaopts);
             }
             
-        _this.draw();
+
+        if (_this.pre_draw_callback){
+            IriSP.jQuery.when(_this.pre_draw_callback()).done(_this.draw());
+        }
+        else {
+            _this.draw();
+        }
         _this.player.trigger("widget-loaded");
     }