Hacker Newsnew | comments | show | ask | jobs | submitlogin
Ask HN: Review my first JavaScript library
2 points by mparke 904 days ago | 4 comments
Hi Everyone,

I have been working on a JavaScript library project that has grown out of discovery and learning what I've found useful in app development. I typically use some of these tools alongside jQuery or something that makes manipulating the DOM easier. I'm looking for some feedback, constructive criticism or just general suggestions. How can I improve the core class system around Object.create? How can I improve publish and subscribe? Any other module or implementation suggestions welcome.

Introduction: http://ordinaryrobot.com/#page-hawkjs_intro Github: https://github.com/mparke/hawk.js

Thanks for any thoughts.




Is there a particular reason you are using Hawk.def and Hawk.gen instead of something more "traditional" like

    Bird = Hawk.create(...)
    falcon = new Bird(...)
How do you deal with inheritance?

    falcon insteanceof Bird; // => is it true?

If bird had mixins would falcon be an instanceof those as well?

-----


Gen is because I use the word generate often in my code, and def rubbed off from Ext.define, no other special reason.

As for instance of, It's something I overlooked in testing, so I'm going to check that now, but my guess is that without mixing it should pass, but with it would fail because of the way I'm just pointing to function references.

Be back in a few with result, thanks for the feedback.

-----


instanceof will fail right now, because I'm not using function constructors and prototype to create the classes. So I'm going to switch it to work that way so checks like instanceof work appropriately. I'll have to see how this affects mixins when i'm done with the changes.

-----


Changed classes and mixins to use function constructors, so instanceof operator will work for both scenarios.

-----




Guidelines | FAQ | Support | API | Lists | Bookmarklet | DMCA | Y Combinator | Apply | Contact

Search: