[Seaside] concatenate JS assignments in script generation

Hernán Morales Durand hernan.morales at gmail.com
Mon May 31 17:17:26 UTC 2010


Hi Johan,

That's because #, is adding your var2 to the statements of var1. In
Seaside 2.8 you may do something like

factory := SUFactory on: (WARenderCanvas
				context: WARenderingContext new
				callbacks: WACallbackRegistry new).
f1 := ( ( factory create: SUFunction ) assignTo: 'x' ).
f2 := ( ( factory create: SUFunction ) assignTo: 'y' ).
f1 after: f2

in Seaside 3.0 it would be

function1 := ( JSFunction context: ( WARenderContext new ) ) asFunction.
function2 := ( JSFunction context: ( WARenderContext new ) ) asFunction.
f1 := ( function1 assignTo: 'x' ).
f2 := ( function2 assignTo: 'y' ).

but I cannot find an #after: equivalence for JSFunction... so doing

JSObject>>after: anObject
	"Call anObject directly after the receiver is evaluated."

	self addDecoration: (JSConcatenation on: anObject)

then you may print

f1 after: f2

hope that helps
Cheers,

Hernán

2010/5/31 Johan Brichau <Johan.Brichau at uclouvain.be>:
> Hi,
>
> I'm a bit puzzled with one of the JSScript features in Seaside 3.0.
>
> I'm trying to generate something like the following javascript:
>
> var1 = function() { ... };
> var2 = function() { .... };
>
> Using the following Seaside code:
>
> script1 := ( ... ) asFunction assignTo: 'var1'.
> script2 := ( ... ) asFunction assignTo: 'var2'.
>
> ^ script1 , script2
>
> However, the concatenation in the return puts all statements of script2 into the body of script1, rather than concatenate the assignments. The result is thus:
>
> var1 = function() { .... ; var2 = function() {...} }
>
> Variables script1 and script2 indeed contain a JSFunction object which is decorated with a JSAssign. So I must be missing something on how this decoration is supposed to work.
> Hope somebody can help me :-)
>
> cheers!
>
> ----------------------------
> Johan Brichau
> johan.brichau at uclouvain.be
>
>
>
>
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>


More information about the seaside mailing list