You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Lars Trieloff (JIRA)" <ji...@apache.org> on 2010/08/11 16:48:17 UTC

[jira] Updated: (SLING-1594) Support CommonJS Modules i.e. the require function

     [ https://issues.apache.org/jira/browse/SLING-1594?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Lars Trieloff updated SLING-1594:
---------------------------------

    Attachment: SLING-1594.patch

This patch implements common.js modules. You can try by putting a file math.js in libs and another file increment.js in apps with the contents described at http://wiki.commonjs.org/wiki/Modules/1.1

Then it is possible to require("increment") in your esp files.

I have noted one problem: on the first run the included script file cannot be read properly, but reloading the resource in the browser helps. I am not sure about the exact source of this issue.

> Support CommonJS Modules i.e. the require function
> --------------------------------------------------
>
>                 Key: SLING-1594
>                 URL: https://issues.apache.org/jira/browse/SLING-1594
>             Project: Sling
>          Issue Type: Improvement
>          Components: Scripting
>            Reporter: Lars Trieloff
>            Priority: Minor
>         Attachments: SLING-1594.patch
>
>
> SLING-320 already allows calling functions in external scripts, so implementing the full-blown modules spec to allow interoperability with other CommonJS modules should be possible.
> http://wiki.commonjs.org/wiki/Modules/1.1.1

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.