repo: janusweb
action: commit
revision: 
path_from: 
revision_from: f5e00168533ab9b0ab365c02949652c996cbc74e:
path_to: 
revision_to: 
git.thebackupbox.net
janusweb
git clone git://git.thebackupbox.net/janusweb
commit f5e00168533ab9b0ab365c02949652c996cbc74e
Author: James Baicoianu 
Date:   Thu Aug 17 01:48:15 2017 -0700

    Expose removeChild and dispatchEvent to scripts, execute named handlers automatically

diff --git a/scripts/janusbase.js b/scripts/janusbase.js
index 13f3cbd9f8cff0afdfd6fcf09a15a9899bb095e4..
index ..db8f14af4353e1c9e7d544476d954ce2dbe75b00 100644
--- a/scripts/janusbase.js
+++ b/scripts/janusbase.js
@@ -169,7 +169,9 @@ elation.require(['engine.things.generic', 'utils.template'], function() {

           createObject:        ['function', 'createObject'],
           appendChild:         ['function', 'appendChild'],
+          removeChild:         ['function', 'removeChild'],
           addEventListener:    ['function', 'addEventListenerProxy'],
+          dispatchEvent:       ['function', 'dispatchEvent'],
           removeEventListener: ['function', 'removeEventListenerProxy'],
           localToWorld:        ['function', 'localToWorld'],
           worldToLocal:        ['function', 'worldToLocal'],
@@ -411,6 +413,10 @@ console.error('dunno what this is', other);
     }
     this.dispatchEvent = function(event) {
       if (!event.element) event.element = this;
+      var handlerfn = 'on' + event.type;
+      if (this[handlerfn]) {
+        this.executeCallback(this[handlerfn], event);
+      }
       return elation.events.fire(event);
     }
     this.addEventListenerProxy = function(name, handler, bubble) {

-----END OF PAGE-----