hi!<br><br><div class="gmail_quote">2009/11/4 Bryan Berry <span dir="ltr">&lt;<a href="mailto:bryan@olenepal.org">bryan@olenepal.org</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

I am refactoring jquery.karma.js using test-driven development. <br></blockquote><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
I think you did a great job in writing it in the first place, but I am<br>
far to lazy to manually test out the entire library every time I make a<br>
change.<br></blockquote><div>interesting, +1 to use test-driven<br>I think it will consume more time, but it will make easier the introduction to new developers<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">


<br>
Reading through jquery.karma.js, I have some questions:<br>
<br>
--- the init function ---<br>
You have an init function that receives the assets to be loaded as an<br>
argument but actually loading them happens in the first part of the if<br>
statement of karma.main . To me it would make more sense to just pass<br>
the assets as an argument to karma.main({ /* assets object */}) and not<br>
the function call back as currently.<br>
<br>
Ideally I would like the use of Karma in lesson.js to be as simple as<br>
<br>
var k = Karma({ images: [ .....], sounds : [...], surfaces : [....]}) <br></blockquote><div>then it will be necessary to define the i18n options first<br>var k = Karma({ i18n: []...., images: [ .....], sounds : [...], surfaces : [....]}) <br>

<br>other way what images/sounds are we suppose to load?<br> <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
// the rest of the code for a lesson<br>
<br>
I don&#39;t understand the if statement in karma.main. It seems to me that<br>
the callback to main function would never be called. That the first if<br>
clause will always be true and karma.main() won&#39;t be called a second<br>
time.<br></blockquote><div>I&#39;m checking if there is something to load ( pendingToLoad ), if yes then I load all the stuff <br>other way the else statement will be executed <br><a href="http://git.sugarlabs.org/projects/karma/repos/mainline/blobs/master/js/jquery.karma.js#line489">http://git.sugarlabs.org/projects/karma/repos/mainline/blobs/master/js/jquery.karma.js#line489</a><br>

<br>anyway the callback function will be executed (if it&#39;s defined)<br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
--- taking out the jquery inside Karma ---<br>
<br>
I like how we have packaged  karma as a jquery library because it gives<br>
us a standard pattern to follow. That said, I don&#39;t want to use jquery<br>
internally to the library so dojo or prototype fans can use it freely<br></blockquote><div>+1<br>we won&#39;t have *any* dependencies, anyway we&#39;re using specific parts (helpers) of jquery (example: $.each )<br><br></div>

<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
--- to prototype or not to prototype? ----<br>
<br>
I intend to use monkey-patch the Object object with the function create<br>
<br>
so Object.prototype.create = function ...<br>
<br>
this create function will be implemented in Ecmascript 5 and it matches<br>
Crockford&#39;s object(o) function for prototypal inheritance. This is my<br>
excuse for monkey patching ;) <br></blockquote><div>interesting, let me read (more) about in order to give you good arguments to discuss it<br> <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">


<br>
-- KButton ----<br>
<br>
What is the purpose of KButton?<br>
<br></blockquote><div>there is no way to create buttons or clickeable elements inside a canvas,<br>as for example, svg has its clickeable property (or something called like that)<br>KButton is a &quot;fast way&quot; to create clickeable canvas sub-regions, this feature can be replaced by multiple canvas<br>

<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
--- mouse.getRelativeCanvasPosition, handleEvents ---<br>
<br>
do you have any code that uses these functions so I can see an example<br>
of them in action?<br></blockquote><div>the mouse class is a helper when using the mouse, if you try to get the mouse coordinates in the &quot;common&quot; ways you will face some troubles, this method fix that problem.<br>

<br></div><div>handleEvents <br>as its name says it, it&#39;s a &quot;master&quot; dispatcher for events, actually just KButton uses it.<br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">


<br>
<br>
<br>
those are the main questions I have for now. Thanks for reading this far<br>
in a long e-mail ;)<br></blockquote><div>thanks for asking ;) <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
I know you are very busy with your exams right now, but do u think we<br>
could chat in the next couple days for about an hour about the structure<br>
of jquery.karma.js?<br>
<br>
I am on the east coast of the US right now so timezones are easier :)<br></blockquote><div>what about this weekend? <br> <br>cheers ;)<br></div></div><br clear="all"><br>-- <br>Felipe López Toledo<br>