node-ethernet-ip icon indicating copy to clipboard operation
node-ethernet-ip copied to clipboard

PLC.foreach() doesn't work

Open planetixin opened this issue 2 years ago • 1 comments

Current Behavior

function doesn't work inside PLC.foreach()

Expected Behavior

PLC.foreach() should work.

Possible Solution (Optional)

Context

const PLC = new Controller(); var number = 0;

PLC.connect('ip adress', 0).then(async () => { PLC.forEach(tag =>{
number++; }); console.log(number);

});

Steps to Reproduce (for bugs only)

Your Environment

  • Package version (Use npm list - e.g. 1.0.6):
  • Node Version (Use node --version - e.g. 9.8.0):
  • Operating System and version: windows 7
  • Controller Type (eg 1756-L83E/B):
  • Controller Firmware (eg 30.11):

planetixin avatar Apr 05 '22 09:04 planetixin

the forEach method is available for a TagGroup instance not on a Controller instance.

cmseaton42 avatar Apr 06 '22 17:04 cmseaton42