Skip to content

RestlessThinker/Javascript-Interface

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 

Javascript-Interface

An Interface Class for Javascript

Usage

var Composite = new Interface('Composite', ['add', 'remove', 'getChild']);
var FormItem = new Interface('FormItem', ['save']);

// Composite Class

var CompositeForm = function (id, method, action) { // implements Composite, FormItem
  ...
};

...

function addForm (formInstance) {
  Interface.ensureImplements(formInstance, Composite, FormItem);
  // This function will throw an error if a required method is not implemented,
  // halting execution of the function.
  // All code beneath this line will be executed only if the checks pass.
  ...
}

About

An Interface Class for Javascript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published