my objective is to use pjs instance inside a javascript Class but I have some problems.
First of all I tried to call pjs.query() inside a module with a Function and following code works:
- modules/myApp/testFunc.js
Code: Select all
function Test() {
this.queryC = function() {
console.log('query...');
let test = pjs.query('select * from sysibm/sysdummy1');
console.log('queryC', test);
return test;
}
}
exports.TestFunc = Test;
Code: Select all
function test() {
var TestF = pjs.require("myapp/testFunc").TestFunc;
var instanceF = new TestF();
console.log('instanceF', instanceF);
instanceF.queryC();
}
exports.run = test;
Code: Select all
instanceF Test { queryC: [Function] }
query...
queryC [ { ibmreqd: 'Y' } ]
- modules/myApp/testClass.js
Code: Select all
class Test {
constructor() {
console.log('costructor...');
}
queryC() {
console.log('query...');
return pjs.query('select * from sysibm/sysdummy1');
}
}
exports.TestClass = Test;
Code: Select all
function test() {
var Test = pjs.require("myapp/testClass").TestClass;
var instance = new Test();
console.log('instance', instance);
instance.queryC();
}
exports.run = test;
Code: Select all
costructor...
instance Test {}
query...
2019-11-25 16:59:58 | Session 89D97A5694117DAA3250F4512948AA1D4719A4C4BF0010EF33D2F5477F847506
TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them
at Test.queryC (C:\Users\diego\code\profoundjs\modules\myapp\testClass.js:12:35)
at Object.test (C:\Users\diego\code\profoundjs\modules\myapp\test.js:13:11)
at Object.profound.call (C:\Users\diego\code\profoundjs\node_modules\profoundjs\api\call.jse:140:25)
at C:\Users\diego\code\profoundjs\node_modules\profoundjs\server\controller.jse:188:25
Do you have any advise?