GoogleAdMob.isAppsInTossAdMobLoaded
Asynchronously checks whether a loadAppsInTossAdMob call has successfully loaded an ad. Use this to gate the show button or as a fallback when the loaded event was missed.
Signature
isAppsInTossAdMobLoaded is exposed as a member of the GoogleAdMob namespace object.
import { GoogleAdMob } from '@apps-in-toss/web-framework';
declare const GoogleAdMob: {
isAppsInTossAdMobLoaded: ((args: IsAdMobLoadedOptions) => Promise<boolean>) & {
isSupported: () => boolean;
};
};
interface IsAdMobLoadedOptions {
adGroupId: string;
}
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
args.adGroupId | string | ✓ | The ad group unit ID to check. |
Returns
Promise<boolean>— resolves totrueif an ad is loaded and ready to show,falseotherwise.
Permission
No permission required — GoogleAdMob.isAppsInTossAdMobLoaded is not bound to a PermissionName. For the typical permission flow used by other namespaces, see Guides — Permissions pattern.
Examples
Minimal
import { GoogleAdMob } from '@apps-in-toss/web-framework';
const isLoaded = await GoogleAdMob.isAppsInTossAdMobLoaded({
adGroupId: 'ad-group-id-here',
});
if (isLoaded) {
console.log('Ad is ready to show');
}
Realistic — gate button state on load status
import { GoogleAdMob } from '@apps-in-toss/web-framework';
import { useEffect, useState } from 'react';
const AD_GROUP_ID = 'ad-group-id-here';
function AdButton() {
const [canShow, setCanShow] = useState(false);
useEffect(() => {
if (!GoogleAdMob.isAppsInTossAdMobLoaded.isSupported()) return;
let cancelled = false;
GoogleAdMob.isAppsInTossAdMobLoaded({ adGroupId: AD_GROUP_ID })
.then((loaded) => {
if (!cancelled) setCanShow(loaded);
})
.catch(console.error);
return () => {
cancelled = true;
};
}, []);
const handleClick = () => {
if (!canShow) return;
GoogleAdMob.showAppsInTossAdMob({
options: { adGroupId: AD_GROUP_ID },
onEvent: (event) => console.log('Ad event', event),
onError: console.error,
});
};
return (
<button type="button" onClick={handleClick} disabled={!canShow}>
{canShow ? 'Show ad' : 'Loading ad...'}
</button>
);
}
Try it live
Open the Ads page in sdk-example to try the GoogleAdMob workflow live.
Open in sdk-exampleRelated APIs
GoogleAdMob.loadAppsInTossAdMob— pre-loads the ad.GoogleAdMob.showAppsInTossAdMob— shows the loaded ad.
Related guides
- Guides — Ads integration pattern — lifecycle, cleanup, and environment guards in one place.
External references
@apps-in-toss/web-framework— SDK package. The actual exports are re-exported from@apps-in-toss/web-bridge.