This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function optional_arg(input, options, callback) { | |
if (!options) { | |
options = {}; | |
} else if (typeof options === 'function') { | |
callback = options; | |
options = {}; | |
} | |
//.... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// FROM ReactJs | |
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
let rootEl = document.getElementById('botsplash-chat-root'); | |
ReactDOM.render( | |
<HostApp | |
appId={appId} | |
serverUrl={serverUrl} | |
settings={settings} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// FROM: ReactJs | |
export default class HostApp extends Component { | |
constructor(props: HostAppProps) { | |
super(props); | |
... | |
} | |
componentDidMount() { | |
... | |
} | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// FROM: ReactJs | |
activateChat() { | |
this.setState({ isChatActive: true }); | |
} | |
// TO: Js | |
setState = (updatedState: Object) => { | |
this.state = {...this.state, ...updatedState}; | |
setTimeout(() => this.updateClasses()); | |
} |