node-ads icon indicating copy to clipboard operation
node-ads copied to clipboard

Update code base to ES6

Open Jozo132 opened this issue 5 years ago • 3 comments

**Includes ADS indexOffset fix caused 'read' 'write' and 'notify' to return values of 0 or false Added '// @ts-check' for improved type checking Replaced all 'var' types to 'const' and 'let' respectively Replaced all 'function' types to 'const' arrow functions Replaced all function inheritences of 'this' to pass as first parameter instead Reduced code size by about 350 lines and structural imrpovements

Code examples must be updated becuase 'this' has to be replaced with your 'client' object Example:

let client = ads.connect(amsConfig, () => {
    console.log(`Trying to read symbol:`, sym)

    //* // Read symbol
    client.read(sym, (err, handle) => {
        if (err) console.log(err)
        console.log('Response:', handle.value)
        client.end()
    })//*/

    /* // Add symbol to notify
    client.notify(sym)
    client.on('notification', handle => {
        console.log('Response:', handle.value);
    });//*/

})
client.on('error', e => {
    console.log(e)
})

Jozo132 avatar Jan 30 '20 10:01 Jozo132

Rebase needed. Also, We might want to support old node versions.

roccomuso avatar Feb 03 '20 10:02 roccomuso

Rebase needed. Also, We might want to support old node versions.

First time I'm doing rebase .. I think I done it right. // Inexperienced GIT user here I agree with the support for old node versions, so do as you see fit. I'll be working on my fork and will do some more testing when I have spare time. What I needed was ADS support for latest node versions on Windows systems, so that's how it got me here.

Jozo132 avatar Feb 04 '20 16:02 Jozo132

cool keep us updated

roccomuso avatar Feb 05 '20 00:02 roccomuso