Skip to content
This repository has been archived by the owner on Jan 24, 2022. It is now read-only.

Reassigning params in functions is not a good practice #21

Closed
mxdi9i7 opened this issue Sep 25, 2018 · 1 comment
Closed

Reassigning params in functions is not a good practice #21

mxdi9i7 opened this issue Sep 25, 2018 · 1 comment

Comments

@mxdi9i7
Copy link

mxdi9i7 commented Sep 25, 2018

In the documentation to allow chat to get access to API methods, the sample code demostrates

onChatLoaded = (ref) => {
 ref.on_after_load = function ()  {
    //here you can use any method you want!
  }		
}

This is not a good practice according to ES standards, you should not reassign ref within the function scope because ref is considered a constant that's passed in as a parameter. please update the documentation to reduce the confusion.

@venits
Copy link
Contributor

venits commented Jan 3, 2019

It this case ref is not refered as DOM element but rather reference to LiveChat object.

@venits venits closed this as completed Jan 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants