You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: readme.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -239,23 +239,23 @@ The expected structure is as follows:
239
239
You can always use another structure, just update your config file to let OpenScript know where to find your components, mediators, and contexts files.
240
240
241
241
## Other JS files
242
-
OpenScript has a builtin loader called `autoload`. This loads any JS file as long as the file has only declared contents such as classes and functions. If not, then the loader cannot load such file.
242
+
OpenScript has a built-in loader called `autoload`. This loads any JS file as long as the file has only declared contents such as classes and functions. If not, then the loader cannot load such file.
243
243
>Please see the ojs-config to understand how to configure the `autoload` object.
244
244
245
245
## Loading Files
246
246
Every file type in the config has a version number. This is because, the browser caches JS files, hence if you change them, you want to update the versions so that a fresh file is loaded.
247
247
248
248
### Namespacing
249
-
All file loaders are of type `OpenScript.AutoLoader`. When an AutoLoader loads a file, it keeps the file in its histories to avoid requesting the file later. Therefore, when you try to load the same file more than once, only one request is made and the rest of the loads only returns the kept file content.
249
+
All file loaders are of type `OpenScript.AutoLoader`. When an AutoLoader loads a file, it keeps it in its history to avoid requesting it later. Therefore, when you try to load the same file more than once, only one request is made and the rest of the loads only return the kept file content.
250
250
251
-
To avoid file clashes, the AutoLoader put the files in a namespace that is similar to the folder structure.
251
+
To avoid file clashes, the AutoLoader puts the files in a namespace similar to the folder structure.
252
252
253
-
For example, a class file with path `js/classes/user/User.js` will be placed in `window.js.classes.user.User`. Therefore, to accesses the class, you need to use `js.classes.user.User.User`.
253
+
For example, a class file with path `js/classes/user/User.js` will be placed in `window.js.classes.user.User`. Therefore, to access the class, you need to use `js.classes.user.User.User`.
254
254
>**Notice the class name is doubled at the end**.
255
255
256
-
Imagine that the `User.js` file has two user classes declared in it: `User` and `Admin`. Therefore, it now makes sense to use the file name as part of the namespace because it make contain multiple classes. In the above example, we will use `js.classes.user.User.Admin` to access the admin class.
256
+
Imagine that the `User.js` file has two user classes declared in it: `User` and `Admin`. Therefore, it now makes sense to use the file name as part of the namespace because it may contain multiple classes. In the above example, we will use `js.classes.user.User.Admin` to access the admin class.
257
257
258
-
However, `AutoLoaders` return a map with key-values pairs. Each Key represent 1 declaration in the file. For our example, the `AutoLoader` will return
258
+
However, `AutoLoaders` return a map with key-value pairs. Each Key represents 1 declaration in the file. For our example, the `AutoLoader` will return
0 commit comments