MLstate/opalang — Issue #40: Event creates data copy in Javascript for every event
Author: Dandandan
Created: 2012-02-26 08:07:33+00:00
State: open

I am using this kind of pattern:

changed(object)
{
//do something with it
}

page() {
bigobject = /BigObject //I want to only have 1 copy of this in JS

}

This code creates atm this kind of code in the page:

$('#1').opachbind('change', (function(event){(_p)(/*OPA2JS*/ {bigobject)}))
$('#2').opachbind('change', (function(event){(_p)(/*OPA2JS*/ {bigobject)}))
$('#3').opachbind('change', (function(event){(_p)(/*OPA2JS*/ {bigobject)}))
$('#4').opachbind('change', (function(event){(_p)(/*OPA2JS*/ {bigobject)}))
$('#5').opachbind('change', (function(event){(_p)(/*OPA2JS*/ {bigobject)}))
$('#6').opachbind('change', (function(event){(_p)(/*OPA2JS*/ {bigobject)}))

The problem for me is, the info about the controls is in bigobject itself, so my page grows O(n^2) with n controls ;).