Inversoft’s Prime.js Open Source Library

Brian Pontarelli

Inversoft is excited to announce the launch of our newest open source library – Prime.js. Prime.js is the JavaScript library that powers CleanSpeak. Prime.js is hosted at Github and you can visit the project website here: http://inversoft.github.io/prime.js/

Prime.js

Prime.js is different than other JavaScript libraries because it was built for object oriented JavaScript. Everything in Prime.js is namespaced and explicit JavaScript objects. We also embraced the new operator and the this variable making them first class citizens again.

We strive to make the Prime.js API as consistent as possible. Our functions only ever have one return type and one set of parameters. We don’t use the same function to get and set variables. Instead, we use explicit functions for each. We use consistent naming rules for functions whenever possible and try to make function parameters and return types as consistent as possible.

We adopted the builder pattern for Prime.js objects. This makes it simpler to code with Prime.js if you have an IDE that supports intelli-sense for JavaScript (such as IntelliJ IDEA). It also makes the code more explicit with little code overhead.

For example:

Prime.js allows you to control the this variable whenever possible. This means you can use your own objects as event listeners or callbacks and the this variable will be set to your object.

Under the hood, Prime.js uses the excellent Sizzle (http://sizzlejs.com) selector engine. This is same engine used by jQuery, which means that developers familiar with the jQuery style of selecting will be able to jump right into using Prime.js.

Prime.js is also fully documented using JSDoc. Many IDEs can use JSDoc to provide good intelli-sense as well as pop-up documentation. It also allows us to generate the documentation on the Prime.js website.

Finally, we wanted Prime.js to be easily debuggable in the browser. Therefore, every function, namespace and object in Prime.js is explicit. We don’t generate code or eval anything. If you run against the original source code for Prime.js, you’ll be able to step into any of our objects and functions.

We encourage you to check out Prime.js and give us your thoughts and feedback.

Happy coding!

Tags:
None