Skip to content
Permalink
Browse files
docs: some minor improvements (#234)
* docs: improve project structure overview

* docs: split long paragraph
  • Loading branch information
raphinesse committed Dec 1, 2020
1 parent ad5b74a commit 2278ac51d26eaa149e858f27f5e770eef0bc2498
Showing 1 changed file with 11 additions and 7 deletions.
@@ -33,8 +33,10 @@ A unified JavaScript layer for [Apache Cordova](http://cordova.apache.org/) proj
./
|-build-tools/ ......... custom bundler for our CommonJS-like modules
|-pkg/ ................. generated platform cordova.js files
|-src/
|
|-src/ ................. the code that makes up Cordova's JavaScript runtime
| |-cordova.js ........ common Cordova stuff
| |
| |-common/ ........... base modules shared across platfoms
| | |-argscheck.js ... utility for type-checking arguments during runtime
| | |-base64.js ...... base64 utilites (toArrayBuffer & fromArrayBuffer)
@@ -43,12 +45,12 @@ A unified JavaScript layer for [Apache Cordova](http://cordova.apache.org/) proj
| | |-init.js ........ bootstraps the Cordova platform, inject APIs and fire events
| | |-utils.js ....... closures, uuids, object, cloning, extending prototypes
| | |
| | |-exec/ .......... exec methods
| | | '-proxy.js .... utility for adding and removing exec proxy methods
| | '-exec/ .......... exec methods
| | '-proxy.js .... utility for adding and removing exec proxy methods
| |
| |-scripts/ .......... non-module JS that gets concatenated to cordova.<platform>.js
| | |-bootstrap.js ... bootstrap the Cordova platform, inject APIs and fire events
| | '-require.js ..... module definition and require() implementation
| '-scripts/ .......... non-module JS that gets concatenated to cordova.<platform>.js
| |-bootstrap.js ... bootstrap the Cordova platform, inject APIs and fire events
| '-require.js ..... module definition and require() implementation
|
'-tests/ ............... unit tests
```
@@ -101,7 +103,9 @@ The **Cordova** *native-to-webview* bridge is initialized in `src/scripts/bootst
cordova.require('cordova/channel').onNativeReady.fire()
```

The `boot` method does all the work. First, it grabs the common platform definition (under `src/common/common.js`) and injects all of the objects defined there onto `window` and other global namespaces. Next, it grabs all of the platform-specific object definitions (as defined under `src/<platform>/platform.js`) and overrides those onto `window`. Finally, it calls the platform-specific `initialize` function (located in the platform definition). At this point, Cordova is fully initialized and ready to roll. Last thing we do is wait for the `DOMContentLoaded` event to fire to make sure the page has loaded properly. Once that is done, Cordova fires the `deviceready` event where you can safely attach functions that consume the Cordova APIs.
The `boot` method does all the work. First, it grabs the common platform definition (under `src/common/common.js`) and injects all of the objects defined there onto `window` and other global namespaces. Next, it grabs all of the platform-specific object definitions (as defined under `src/<platform>/platform.js`) and overrides those onto `window`.

Finally, it calls the platform-specific `initialize` function (located in the platform definition). At this point, Cordova is fully initialized and ready to roll. Last thing we do is wait for the `DOMContentLoaded` event to fire to make sure the page has loaded properly. Once that is done, Cordova fires the `deviceready` event where you can safely attach functions that consume the Cordova APIs.

## Testing

0 comments on commit 2278ac5

Please sign in to comment.