This topic contains 3 replies, has 0 voices, and was last updated by chanarbon 7 years, 10 months ago.
-
AuthorPosts
-
January 10, 2017 at 7:32 am #1328
mhson1978Hey guys. Have you tried using a reference js file that simply contains variables in SS2.0? For example, in SS1.0, i simply attached it as library file on the script definition. In SS2.0, if I have a file that contains java script variables to be used by other scripts, how would i do that?
Do i still need to use the full syntax to include
define([],
function() {
return{
‘myVar1’:{‘test’:’test’},
‘myVar2’:{‘moretest’:’moretext’}
}
}
I used to use this method so that I can use schedule script to generate a JS variable files.
This is a cached copy. Click here to see the original post. -
January 10, 2017 at 8:13 am #1329
erictgrubaughYes you will still need to build a module that contains your variables. For example, you’d create the values library:
Code:
// myLibrary.js
define([], function () {
return {
“x” : 5,
“y” : “abcdefg”
};
});
Then I can put this module to use:Code:
define([“path/to/myLibrary”], function (lib) {
console.log(“x = ” + lib.x);
console.log(“y = ” + lib.y);
}); -
January 10, 2017 at 10:08 am #1330
mhson1978That’s what I was afraid of. I guess I can still have backend script regenerate the js file.
Thank you for your response!
ironside replied on 01/11/2017, 03:38 AM: If you write your code in TypeScript it will generate the AMD module boilerplate for you (or several other module systems, for that matter).
-
January 11, 2017 at 4:23 am #1331
chanarbonThings to note on this can be on SuiteAnswers ID 61160 (https://netsuite.custhelp.com/app/an…ail/a_id/61160), and SuiteAnswers ID 51781 (https://netsuite.custhelp.com/app/an…ail/a_id/51781)
-
AuthorPosts
You must be logged in to reply to this topic.
