1.0.30 • Published 7 years ago

irrelon-appcore v1.0.30

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

Irrelon Appcore

A very lightweight application dependency manager for maintaining clean modularised code.

Usage

Include in HEAD

<script type="text/javascript" src="./index.js"></script>

Once included, AppCore exposes itself via window.appCore.

Define Modules

appCore.module('myFirst', function () {
  var MyFirstModule = function () {};
  
  MyFirstModule.prototype.hello = function () {
    console.log('Hello!');
  };
  
  return MyFirstModule;
});

When defining modules, you can include the other modules as dependencies by adding them to the function arguments e.g.:

appCore.module('mySecondModule', function (MyFirstModule) {
  var firstModule = new MyFirstModule();
  firstModule.hello(); // Logs "Hello!"
});

Module Return Values

Modules can return anything. In the example above we have returned an object prototype that then gets instantiated in MySecondModule but it could have been any value.

Singletons

Module functions are only executed ONCE, after all the module's dependencies are resolved. This means you can return an instantiated object if you wish, and further dependecies will use the originally instantiated object rather than creating a new one each time the dependency is requested. Internally we simply store the return value from the module's function and hand that value to any request for the module in the future.

License

MIT license. Fully free open-source, no copy-left, no nonsense. Use it how you like. Power to the people.

Questions, Bugs, Comments, Requests?

Please use the github issue tracker for any communications. Do not email me. If you ask something publically then everyone can get the benefit of the response.

1.0.30

7 years ago

1.0.29

7 years ago

1.0.28

7 years ago

1.0.27

7 years ago

1.0.26

7 years ago

1.0.25

7 years ago

1.0.24

7 years ago

1.0.23

7 years ago

1.0.22

7 years ago

1.0.21

7 years ago

1.0.20

7 years ago

1.0.19

7 years ago

1.0.18

7 years ago

1.0.17

7 years ago

1.0.16

7 years ago

1.0.15

7 years ago

1.0.14

7 years ago

1.0.13

7 years ago

1.0.12

7 years ago

1.0.11

7 years ago

1.0.10

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago