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

Felipe López Toledo zer.subzero at gmail.com
Sat Nov 7 19:45:36 EST 2009


2009/11/6 Bryan Berry <bryan at olenepal.org>

> On Thu, 2009-11-05 at 22:43 +0100, Felipe López Toledo wrote:
> >
> > interesting, +1 to use test-driven
> > I think it will consume more time, but it will make easier the
> > introduction to new developers
>
> I haven't made that much progress yet but u can see the start here:
>
>
> http://git.sugarlabs.org/projects/karma/repos/mainline/blobs/jkjs-refactor/tests/index.html
>
> and all the tests here:
>
> http://git.sugarlabs.org/projects/karma/repos/mainline/blobs/jkjs-refactor/tests/tests.js
>
> So far I have only stubbed out the tests and code for the helper
> methods.
>
> >
> >         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 :
> >         [....]})
> > then it will be necessary to define the i18n options first
> > var k = Karma({ i18n: []...., images: [ .....], sounds : [...],
> > surfaces : [....]})
>
> +1,
>
> I think the property locale : "en"  will be sufficient
>
I'm supposing that defining nothing  will auto locale

>
> > other way what images/sounds are we suppose to load?
> >
> >
> >
> >         // 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.
> > I'm checking if there is something to load ( pendingToLoad ), if yes
> > then I load all the stuff
> > other way the else statement will be executed
> >
> http://git.sugarlabs.org/projects/karma/repos/mainline/blobs/master/js/jquery.karma.js#line489
> >
> > anyway the callback function will be executed (if it's defined)
>
> I don't see how that works. It seems to me that if there is anything
> pendingToLoad it is loaded, and the callback isn't called.
>
when all the items are loaded (or have reported any error) then the callback
function will be called
http://git.sugarlabs.org/projects/karma/repos/mainline/blobs/master/js/jquery.karma.js#line463


>
> >
> > +1
> > we won't have *any* dependencies, anyway we're using specific parts
> > (helpers) of jquery (example: $.each )
>
> and we don't need $.each because the browsers support
> Array.prototype.forEach . Also, I implemented $.extend as objectPlus
>
>
> http://git.sugarlabs.org/projects/karma/repos/mainline/blobs/jkjs-refactor/js/karma.js#line57
>
> +1
there are just few jQuery functions that I used, like $.extend...

>
>
> >
> > interesting, let me read (more) about in order to give you good
> > arguments to discuss it
> >
> >
> >
> >         -- KButton ----
> >
> >         What is the purpose of KButton?
> >
> > there is no way to create buttons or clickeable elements inside a
> > canvas,
> > as for example, svg has its clickeable property (or something called
> > like that)
> > KButton is a "fast way" to create clickeable canvas sub-regions, this
> > feature can be replaced by multiple canvas
>
> But do we still need it? should i leave it in?
>
no, afaik SVG supports clickeable (draggable and so on) actions

> what about this weekend?
>
> That works for me. How about Sunday before 11 am EST?
>
11 am EST = 11 am UTC-5 = 10 am México
ok :)

>
>
> --
> Bryan W. Berry
> Senior Engineer
> OLE Nepal, http://www.olenepal.org
>
>


-- 
Felipe López Toledo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.sugarlabs.org/archive/sugar-devel/attachments/20091107/7cefd952/attachment.htm 


More information about the Sugar-devel mailing list