Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
31 lines (24 sloc) 957 Bytes


To create a component you need first to define a class. That's what absurd.component API is for.

var absurd = Absurd();
var CompClass = absurd.component("CompClass", {
	constructor: function(param) {
		// ...
var component = CompClass();

Every component has a constructor function which is called once you create a new instance of the class. Your component may or may not accept arguments.

Local variables and methods

There is no wrapper or something around the object which you pass during the class's definition. This means that you could define variables or methods and they are accessible as public API of your component.

var Human = absurd.component("Human", {
	name: '',
	sayHi: function() {
		alert('Hello, my name is ' + + '.');
	constructor: function(firstname, lastname) { = firstname + ' ' + lastname;
var human = Human('John', 'Black');