Re: EmergeTk -- C# bindings for dojo, comet.
Hi Ben,
I've been checking your project religiously ever since your posted a
hint on the dojo blog 2 months ago. At one point I even managed to
uncover the prototype home page digging through the links on your blog.
Anyways forgive my obtusity but reading through the code I still can't
seem to figure out how exactly you are binding to dojo itself and what
the mechanisms for working this binding are. Or in other words I can see
and understand your framework, I just don't notice dojo in it, although
it's lying in the bin folder :) Hmm must be something just round the
corner, possibly in the Widget.cs or client_master.js but I would have
expected more a class-for-class binding like .NET does for the standard
windows API. You must be doing some heavy duty runtime reflection magic.
Could you provide a short overview of what is going on and where it will
go from here in relation to the dojo part?
Dojo Forum
Comments
George,
It's a great question. There is certainly a lot of reflection happening.
Most of the wrapping actually occurs in client.js. The widgets in
0.2.2didn't seem entirely stable, so I sandboxed them on the client.
I don't
necessarily defend this approach, but it works.
Now that dojo 0.3 is out, and the widgets look a lot more stable, I'm going
to revisit the relationship. I may keep the emerge client side wrappers, or
I may move to instantiating the dojo widgets directly. Any suggestions here
are of course appreciated.
Here's an example of how a dojo control is wrapped, I'll show you the window
widget:
like you said, there's not much in the C# (for now):
public class Window : Pane
{
}
just enough for reflection to see that this is a div with a different name.
and then the javascript wrapper:
Window.inherits( Widget );
function Window( args )
{
dojo.require("dojo.widget.ResizeHandle");
dojo.require("dojo.widget.FloatingPane");
this.elemType = "DIV";
this.Widget(args);
}
Window.prototype.Render = function()
{
this.uber("Render", arguments);
var win = this.window =
dojo.widget.createWidget("FloatingPane",{id:this.id +
"_win"},this.elem);
win.domNode.style.left = 50;
win.domNode.style.top = 50;
win.domNode.style.height = 650;
win.domNode.style.width = 650;
this.elem = win.clientPane.domNode;
}
thanks for the feedback!
--ben
On 6/1/06, George Costanza wrote:
--
ben joldersma
http://ben.creationsnetwork.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://dojotoolkit.org/pipermail/dojo-interest/attachments/20060601/a4a1...
Hi Ben,
Thank you for the explanation. I was kind of surprised when I saw so
lightweight wrappers in C# and wanted to be sure on what was going on.
Having though about your framework for a while would it be terribly
wrong to say that it's something like Apache XAP for .NET
(http://www.roks.xmgfree.com/blog/2006/05/15/apache-xap-proposal/)? Also
do you have any thoughts about possibly leveraging on Nikhil Kothari's
Script# (http://www.nikhilk.net/ScriptSharpIntro.aspx), assuming of
course Microsoft don't take it in the wrong direction making it
impossible to use in something other than their frameworks.
George,
The significant difference between emerge and these two projects is that
emerge is a server oriented runtime. You can use templates, but they are
processed on the server. XAP on the other hand, appears to be a client-side
templating system, and Script# is a pre-processing event, so you will not
have available to you any of your c# classes, services, etc., once your
javascript class actually runs.
I tend to agree with the consensus on Ajaxian about generating javascript
with java or c#: Javascript is a great language, and becoming greater all
the time, I don't feel any need to avoid working with it, especially with a
project like dojo. But you know -- you ask if you think I could leverage
the ideas, and maybe I could -- it's tempting to build more complex widgets
entirely on the server, grouping together a number of more primitive widgets
-- maybe we could compile these more abstract widgets into client side
aggregatio. That might accelerate performance...
XAP seems like it could be useful, but I'll probably just defer to the
decisions the dojo community makes on it -- I'm happy with the widgets I
have now. Besides -- I'm instantiating my widgets programmatically, not
declaratively, so I'd need that support in the project.
All good projects I'm sure, just with different strengths and weaknesses.
thanks,
--ben
On 6/2/06, George Costanza wrote:
--
ben joldersma
http://ben.creationsnetwork.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://dojotoolkit.org/pipermail/dojo-interest/attachments/20060602/99a5...