Skip to content
This repository was archived by the owner on Jan 13, 2022. It is now read-only.

getting started

oatkiller edited this page Sep 13, 2010 · 5 revisions

download oatlib

oatlib uses sprockets for dependency managemnt, and i like to create custom versions of oatlib which include the exact functions i need. this is why oatlib is split into hundreds of files. for now you can just go to downloads and download oatlib.debug.js. when you’ve finished the code for your project you can build a version of oatlib that doesn’t have anything thats unnecessary.

include oatlib in your pages


...
<!-- oatlib goes right before the closing body tag of your site. 
it will work if you put it other places, but i don't use any of 
that onDomContentLoaded type stuff. -->

<script src="/path/to/oatlib.debug.js"></script>
</body>
...

now write some code using oatlib

(function () {

// you need to get a reference to oatlib. 
// there is a global oatlib object, but its 
//	a non-colliding property of the global object
// so always type this at the beginning of your js

var o = window['http://oatlab.com/oatlib/v2'];

// now you can do stuff with oatlib

// create a new fragment
var my_fragment = o.dom.fragment('<h1>oatlib is the indomitable javascript library</h1><p>fragments are a great feature you probably dont use</p>');
o.dom.prepend_child(document.body,my_fragment);

})();
Clone this wiki locally