LP#1708291: teach egEmbedFrame about an afterload function
authorMike Rylander <mrylander@gmail.com>
Thu, 25 May 2017 00:37:17 +0000 (20:37 -0400)
committerDan Wells <dbw2@calvin.edu>
Fri, 1 Sep 2017 16:47:13 +0000 (12:47 -0400)
The 'afterload' attribute added by this patch allows specifying
the name of a function (to be supplied by the embedded content)
to run after the frame has been loaded.

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Signed-off-by: Dan Wells <dbw2@calvin.edu>
Open-ILS/web/js/ui/default/staff/services/eframe.js

index 3beaa7c..ae26e7f 100644 (file)
@@ -19,6 +19,9 @@ angular.module('egCoreMod')
             // called after onload of each new iframe page
             onchange : '=?',
 
+            // called after egFrameEmbedLoader, during link phase
+            afterload : '@',
+
             // for tweaking height
             saveSpace : '@',
             minHeight : '=?',
@@ -39,7 +42,10 @@ angular.module('egCoreMod')
             window.IEMBEDXUL = true;
             element.find('iframe').on(
                 'load',
-                function() {scope.egEmbedFrameLoader(this)}
+                function() {
+                    scope.egEmbedFrameLoader(this);
+                    if (scope.afterload) this.contentWindow[scope.afterload]();
+                }
             );
         },