tode.isReady
Check if Tode is initialized and ready to track events.
Usage
TypeScript
if (tode.isReady) {
tode.trackAction('action');
}Type
boolean
Description
Returns true when Tode has been successfully initialized and events go out immediately. You don't have to check it before tracking: events tracked earlier are held (up to 50) and sent once it turns true. It is useful for showing a status or disabling UI until analytics is connected.
Examples
Basic check
TypeScript
import { tode } from '@tode-sdk/core';
if (tode.isReady) {
tode.trackAction('plugin_opened');
}In UI code with framework adapters
React:
TypeScript
const { tode, isReady } = useTode();
const handleClick = () => {
if (isReady) {
tode.trackAction('button_clicked');
}
};Vue:
Vue
<script setup>
const { isReady, trackAction } = useTode();
const handleClick = () => {
if (isReady.value) {
trackAction('button_clicked');
}
};
</script>Conditional UI
TypeScript
function TrackButton() {
const { isReady, tode } = useTode();
return (
<button
onClick={() => tode.trackAction('click')}
disabled={!isReady}
>
Track Action
</button>
);
}Notes
- Returns
falseuntiltode.init()completes successfully - Framework adapters provide reactive versions of this property
- Always check before tracking to ensure events are captured
See Also
- tode.init() - Initialize Tode
- tode.trackAction() - Track actions