[JSMODELS-17] Enable load function of Magnolia resource Created: 14/Aug/17 Updated: 24/Aug/17 Resolved: 22/Aug/17 |
|
| Status: | Closed |
| Project: | Magnolia Javascript Models |
| Component/s: | None |
| Affects Version/s: | 1.0 |
| Fix Version/s: | 1.0 |
| Type: | Improvement | Priority: | Neutral |
| Reporter: | Christoph Meier | Assignee: | Jaroslav Simak |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Template: |
|
| Acceptance criteria: |
Empty
|
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
| Date of First Response: | |
| Sprint: | Kromeriz 110 |
| Story Points: | 3 |
| Description |
|
In a JavaScript model you can load other js files which define other JavaScript classes.
load(__PATH__ + "/../js/utils.js");
The _PATH_ variable is evaluated by the system, it is the path of the script (which calls load) on the file system. This is breaking the concept that a JS model can be any Magnolia resource (currently a Magnolia resource can be from the file system, from classpath or a file representation in a JCR node). An improved version should support something like this:
loadScript('/path/to/resource/in/our/resource/origin')
e.g.
loadScript('/javascript-model-samples/templates/js/formProcessors/saveContact.js')
|
| Comments |
| Comment by Roman Kovařík [ 22/Aug/17 ] |
|
For the record: it's possible to create cycle with loadScript() resulting into a stackoverflow error. |
| Comment by Jaroslav Simak [ 24/Aug/17 ] |
|
cmeier |
| Comment by Christoph Meier [ 24/Aug/17 ] |
|
|