Re: [Sugar-devel] [Karma] questions about jquery.karma.js
On Sat, 2009-11-07 at 18:45 -0600, Felipe López Toledo wrote: That works for me. How about Sunday before 11 am EST? 11 am EST = 11 am UTC-5 = 10 am México ok :) great! see u then -- Bryan W. Berry Senior Engineer OLE Nepal, http://www.olenepal.org ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [Karma] questions about jquery.karma.js
hi! 2009/11/4 Bryan Berry br...@olenepal.org 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. interesting, +1 to use test-driven I think it will consume more time, but it will make easier the introduction to new developers 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 : []}) 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) --- 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 +1 we won't have *any* dependencies, anyway we're using specific parts (helpers) of jquery (example: $.each ) --- 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 ;) 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 --- mouse.getRelativeCanvasPosition, handleEvents --- do you have any code that uses these functions so I can see an example of them in action? the mouse class is a helper when using the mouse, if you try to get the mouse coordinates in the common ways you will face some troubles, this method fix that problem. handleEvents as its name says it, it's a master dispatcher for events, actually just KButton uses it. those are the main questions I have for now. Thanks for reading this far in a long e-mail ;) thanks for asking ;) 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 :) what about this weekend? cheers ;) -- Felipe López Toledo ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [Karma] questions about jquery.karma.js
On Wed, 2009-11-04 at 08:36 +, 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 br...@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@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel -- Bryan W. Berry Senior Engineer OLE Nepal, http://www.olenepal.org ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
[Sugar-devel] [Karma] questions about jquery.karma.js
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@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel