[Sugar-devel] [Karma] questions about jquery.karma.js

Bryan Berry bryan at olenepal.org
Wed Nov 4 19:50:13 EST 2009


On Wed, 2009-11-04 at 08:36 +0000, Lucian Branescu wrote:
> There's one point I want to nitpick on, you can make karma usable with
> any library even if it uses jquery internally. Jquery is especially
> well suited for this since it the least invasive (it even injects just
> one object).


That's a good point. I am using jQuery for things that I can also do
very easily w/ regular js.

> > On 4 Nov 2009 05:04, "Bryan Berry" <bryan at olenepal.org> wrote:
> > 
> > I am refactoring jquery.karma.js using test-driven development.
> > 
> > I think you did a great job in writing it in the first place, but I
> > am
> > far to lazy to manually test out the entire library every time I
> > make a
> > change.
> > 
> > Reading through jquery.karma.js, I have some questions:
> > 
> > --- the init function ---
> > You have an init function that receives the assets to be loaded as
> > an
> > argument but actually loading them happens in the first part of the
> > if
> > statement of karma.main . To me it would make more sense to just
> > pass
> > the assets as an argument to karma.main({ /* assets object */}) and
> > not
> > the function call back as currently.
> > 
> > Ideally I would like the use of Karma in lesson.js to be as simple
> > as
> > 
> > var k = Karma({ images: [ .....], sounds : [...], surfaces :
> > [....]})
> > 
> > // the rest of the code for a lesson
> > 
> > I don't understand the if statement in karma.main. It seems to me
> > that
> > the callback to main function would never be called. That the first
> > if
> > clause will always be true and karma.main() won't be called a second
> > time.
> > 
> > --- taking out the jquery inside Karma ---
> > 
> > I like how we have packaged  karma as a jquery library because it
> > gives
> > us a standard pattern to follow. That said, I don't want to use
> > jquery
> > internally to the library so dojo or prototype fans can use it
> > freely
> > 
> > --- to prototype or not to prototype? ----
> > 
> > I intend to use monkey-patch the Object object with the function
> > create
> > 
> > so Object.prototype.create = function ...
> > 
> > this create function will be implemented in Ecmascript 5 and it
> > matches
> > Crockford's object(o) function for prototypal inheritance. This is
> > my
> > excuse for monkey patching ;)
> > 
> > -- KButton ----
> > 
> > What is the purpose of KButton?
> > 
> > 
> > --- mouse.getRelativeCanvasPosition, handleEvents ---
> > 
> > do you have any code that uses these functions so I can see an
> > example
> > of them in action?
> > 
> > 
> > 
> > those are the main questions I have for now. Thanks for reading this
> > far
> > in a long e-mail ;)
> > 
> > I know you are very busy with your exams right now, but do u think
> > we
> > could chat in the next couple days for about an hour about the
> > structure
> > of jquery.karma.js?
> > 
> > I am on the east coast of the US right now so timezones are
> > easier :)
> > 
> > --
> > Bryan W. Berry
> > Senior Engineer
> > OLE Nepal, http://www.olenepal.org
> > 
> > _______________________________________________
> > Sugar-devel mailing list
> > Sugar-devel at lists.sugarlabs.org
> > http://lists.sugarlabs.org/listinfo/sugar-devel
> 
-- 
Bryan W. Berry
Senior Engineer
OLE Nepal, http://www.olenepal.org



More information about the Sugar-devel mailing list