I'm working on a site built using Demandware (hosted ecommerce platform). Demandware is built on Java, and has Rhino included for scripting. ES4th edition proposal is supported with JS 1.7, but there seem to be limitations/bugs in some of the native ES functionality. Scripts are given the extension .ds, variables are not exported (only functions).
To get Moment working within Demandware, I renamed the file to Moment.ds, and added the following to the top of the file:
// Function to make Moment available
var moment;
function getMoment() {
return moment;
}
Then in any script that includes Moment.ds, I have to add var moment = getMoment();.
If you could add this information somewhere, or somehow use it to further expose Moment for closed environments such as Demandware, that would be excellent.
I'm working on a site built using Demandware (hosted ecommerce platform). Demandware is built on Java, and has Rhino included for scripting. ES4th edition proposal is supported with JS 1.7, but there seem to be limitations/bugs in some of the native ES functionality. Scripts are given the extension .ds, variables are not exported (only functions).
To get Moment working within Demandware, I renamed the file to Moment.ds, and added the following to the top of the file:
Then in any script that includes Moment.ds, I have to add
var moment = getMoment();.If you could add this information somewhere, or somehow use it to further expose Moment for closed environments such as Demandware, that would be excellent.