/**
 * NOTE: This is a example of usage of the interface
 **/

// Construct interfaces
var foo = new interface.Interface('foo',['getFoo','setFoo']);
var bar = new interface.Interface('bar',['alterBar']);

// Simple class which fully implements "foo" and "bar"
var Ok = function(){
    interface.implements(this,foo,bar);
};
Ok.prototype.getFoo = function(){/* Do something... */};
Ok.prototype.setFoo = function(v){/* Do something... */};
Ok.prototype.alterBar = function(){/* Do something... */};

// Simple class which fail to implement "foo" and "bar"
var Fail = function(){
    interface.implements(this,foo,bar);
};
Fail.prototype.getFoo = function(){/* Do something... */};
// setFoo is commented out to provide failure:
// Fail.prototype.setFoo = function(v){/* Do something... */};
Fail.prototype.alterBar = function(){/* Do something... */};


// Function called from eventhandler which will instantiat a object which implements the interfaces
function initOk(){
    document.getElementById('ok').innerHTML = 'Test object 1 failed to instantiat - See error console for error message!';
    var ok = new Ok();
    document.getElementById('ok').innerHTML = 'Test object 1 instantiated!';
}

// Function called from eventhandler which will instantiat a object which fail to implement the interfaces
function initFail(){
    document.getElementById('fail').innerHTML = 'Test object 2 failed to instantiat - See error console for error message!';
    var fail = new Fail();
    document.getElementById('fail').innerHTML = 'Test object 2 instantiated!';
}