Skip to content

allonhadaya/define.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

define.js

define.js is a minimalist module system for js

define(function one() {
  return 1;
});

define(function two(one) {
  return one + one;
});
// modules may be anonymous
define(function(window, one, two) {
  window.console.log('The sum of one and two is ', one + two);
});
// modules may be stateful
define(function counter() {
  var calls = 0;
  return function() { return ++calls; };
});

define(function(window, counter) {
  window.console.log(counter(), counter());
});
// modules may be safe
define(function(notDefined) {
  // throws an error!
});

About

A minimal module system for js

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published