From 7615848f8340286460433f31a37aa745042add41 Mon Sep 17 00:00:00 2001 From: Vinyl Darkscratch Date: Tue, 18 Oct 2016 18:27:37 -0700 Subject: [PATCH] Add a fired event after the component has finished loading MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sometimes we may want to know when the component is finished with it’s loading process entirely to trigger animations or something similar. I added this for my own website, and I think that others may want to use this. It’s a small addition, but I hope that it will be helpful to others! --- applications/admin/static/js/web2py.js | 1 + applications/examples/static/js/web2py.js | 1 + applications/welcome/static/js/web2py.js | 1 + 3 files changed, 3 insertions(+) diff --git a/applications/admin/static/js/web2py.js b/applications/admin/static/js/web2py.js index 7853e8cb9..7b9d9802e 100644 --- a/applications/admin/static/js/web2py.js +++ b/applications/admin/static/js/web2py.js @@ -338,6 +338,7 @@ web2py.trap_form(action, target); web2py.ajax_init('#' + target); web2py.after_ajax(xhr); + web2py.fire(element, 'w2p:componentComplete', [xhr, status], target); // Let us know the component is finished loading } }); } diff --git a/applications/examples/static/js/web2py.js b/applications/examples/static/js/web2py.js index 7853e8cb9..7b9d9802e 100644 --- a/applications/examples/static/js/web2py.js +++ b/applications/examples/static/js/web2py.js @@ -338,6 +338,7 @@ web2py.trap_form(action, target); web2py.ajax_init('#' + target); web2py.after_ajax(xhr); + web2py.fire(element, 'w2p:componentComplete', [xhr, status], target); // Let us know the component is finished loading } }); } diff --git a/applications/welcome/static/js/web2py.js b/applications/welcome/static/js/web2py.js index 7853e8cb9..7b9d9802e 100644 --- a/applications/welcome/static/js/web2py.js +++ b/applications/welcome/static/js/web2py.js @@ -338,6 +338,7 @@ web2py.trap_form(action, target); web2py.ajax_init('#' + target); web2py.after_ajax(xhr); + web2py.fire(element, 'w2p:componentComplete', [xhr, status], target); // Let us know the component is finished loading } }); }