Chores
- Update the markdown documentations for the new approach of callbacks.
- Fix code format.
Breaking Changes
Callback
We implement a new simplified and cleaner approach for callback of messenger. The previous was a bit clutter when you use multiple callbacks that cause populating the component props and events are automatically added when the library is loaded.
The new update is simply passing a function as a callback into $tawkMessenger
object by specifying the event name. Event listeners
will be added when the event was only called.
Previous way
function App() {
const onLoad = () => {
// your code here
};
return (
<div>
<TawkMessenger
onLoad={onLoad}/>
</div>
);
}
New way
function App() {
let $tawkMessenger;
$tawkMessenger.onLoad(() => {
// your code here
});
return (
<div>
<TawkMessenger
ref={$tawkMessenger}/>
</div>
);
}