File tree 1 file changed +11
-6
lines changed
1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -39,17 +39,22 @@ export function Renderer(options) {
39
39
40
40
// use a function, not an arrow, in order to be able to pass "arguments" through
41
41
this . render = function ( ) {
42
+ const renderArgs = arguments
43
+ const runRender = ( ) => {
44
+ if ( this . _render ) {
45
+ this . _render . apply ( this , renderArgs )
46
+ } else {
47
+ utils . logWarn ( `No render function was provided, please use .setRender on the renderer` ) ;
48
+ }
49
+ }
50
+
42
51
if ( ! isRendererPreferredFromAdUnit ( adUnitCode ) ) {
43
52
// we expect to load a renderer url once only so cache the request to load script
53
+ this . cmd . unshift ( runRender ) // should render run first ?
44
54
loadExternalScript ( url , moduleCode , this . callback ) ;
45
55
} else {
46
56
utils . logWarn ( `External Js not loaded by Renderer since renderer url and callback is already defined on adUnit ${ adUnitCode } ` ) ;
47
- }
48
-
49
- if ( this . _render ) {
50
- this . _render . apply ( this , arguments ) // _render is expected to use push as appropriate
51
- } else {
52
- utils . logWarn ( `No render function was provided, please use .setRender on the renderer` ) ;
57
+ runRender ( )
53
58
}
54
59
} . bind ( this ) // bind the function to this object to avoid 'this' errors
55
60
}
You can’t perform that action at this time.
0 commit comments