Skip to content

Commit

Permalink
Documentation (#168)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudBuchholz committed Oct 16, 2017
1 parent 8e13241 commit 88fb58a
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions doc/tutorials/REQUIRE.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
The library offers a way to organize the code by creating separate source files (modules) and load them when needed by
declaring dependencies between them.
The library proposes a way to organize the code by creating separate source files (modules) with dependencies.
The ({@see gpf.require.define}) API is the main entry point.

Scope is private
A module has several properties:
- Its scope is private: you can define variables inside it...
- Dependencies are resolved then injected

Whatever the module format you want to apply, it must always start with a call to gpf.require.define.
No factory function is required and you know when dependant modules are loaded because of the returned promise that is
resolved upon successful loading of dependencies.

## GPF Module

```JavaScript
gpf.require.define({

}, function (require) {

});
```


## Asynchronous Module Definition (AMD)

The [AMD](https://en.wikipedia.org/wiki/Asynchronous_module_definition) format

```JavaScript
define("amd", ["data.json"], function (data) {
"use strict";
Expand Down

0 comments on commit 88fb58a

Please sign in to comment.