MTNathan
12/13/2019, 5:14 PMbattk
12/13/2019, 5:20 PMbattk
12/13/2019, 5:21 PMbattk
12/13/2019, 5:21 PMMTNathan
12/13/2019, 5:23 PMbattk
12/13/2019, 5:25 PMbattk
12/13/2019, 5:26 PM/**
* @NApiVersion 2.x
* @NScriptType ClientScript
*/
define([], function() {
function pageInitTest(context) {
console.log("Start page init");
}
window.testFunction = function(options) {
console.log("Start test function");
};
return {
pageInit: pageInitTest
};
});
MTNathan
12/13/2019, 5:27 PMwindow
within the define. I assume I could use any modules loaded in the define within that function without issue?MTNathan
12/13/2019, 5:30 PMFail to evaluate script: org.mozilla.javascript.EcmaError: ReferenceError: "window" is not defined.
battk
12/13/2019, 5:32 PM/**
* @NApiVersion 2.x
* @NScriptType ClientScript
*/
require([], function() {
function pageInitTest(context) {
console.log("Start page init");
}
(function() {
this.testFunction = function(options) {
console.log("Start test function");
};
})();
return {
pageInit: pageInitTest
};
});
battk
12/13/2019, 5:34 PMbattk
12/13/2019, 5:36 PM/**
* @NApiVersion 2.x
* @NScriptType ClientScript
*/
define([], function() {
function pageInitTest(context) {
console.log("Start page init");
}
if (document) {
document.getElementById("whateverIdYouGiveToYourAnchor").onclick = function(
options
) {
console.log("Start test function");
};
}
return {
pageInit: pageInitTest
};
});
MTNathan
12/13/2019, 5:37 PMbattk
12/13/2019, 5:38 PMbattk
12/13/2019, 5:38 PMMTNathan
12/13/2019, 5:40 PM