EformMapperInfotron

For information on the term "EForm" please read this.

Sample Declaration

<div id=""
     impl=""
     properties=""
     script=""></div>
## Input Terminals ## Output Terminals ## Properties ## Demos that use it ## How does it work? ## Source ------

BLUEPRINT(
"~01660AD87B187D4b4eA9DA34D6B8B8D6D3", 
[
 ["eform_in", "onEform", 10]
],
[
 "mapped_eform_out"
],
function (Class) 
{
    Class.prototype._onInit = function(props)
    {
      this._map = props["map"] || [];
      this._n_map = this._map.length;
      this._default_eform = props["default_eform"] || {};
      
    };

    Class.prototype._copyEform = function(ef)
    {
      var new_ef = {};

      for (key in ef) {
    new_ef[key] = ef[key];
      }

      return new_ef;
    }

    Class.prototype.onEform = function(msg)
    {
      var i, key;
      var ef = this._copyEform(msg);

      for (key in this._default_eform) {
    ef[key] = this._default_eform[key];
      }

      for (i = 0; i < this._n_map; i ++) {
    ef[this._map[i][1]] = msg[this._map[i][0]];
      }


      this.postMessage("mapped_eform_out", ef);
    };

}, "Eform Mapper");