Skip to Content
defold-typescript libraries
megalanthusdefold-gamepush

megalanthus/defold-gamepush/gamepush.core.ads

GamePush advertising: fullscreen, preloader, rewarded and sticky banner ads, their availability and their events.

  • GitHub: megalanthus/defold-gamepush — pinned to v1.4.1
    1. Pick a release from megalanthus/defold-gamepush releases and add its Source code (zip) URL (or a packaged .zip asset, if the library ships one) to game.project under [project] dependencies, then Fetch Libraries in the Defold editor.
    2. Run bunx @defold-typescript/cli resolve to materialize its types.
    3. Import it under a namespace alias of your choice:
      import * as core_ads from "gamepush.core.ads"

Functions

is_adblock_enabled(): boolean

Whether an ad blocker is on.

Returns

  • boolean

is_sticky_available(): boolean

Whether the sticky banner is available.

Returns

  • boolean

is_fullscreen_available(): boolean

Whether fullscreen ads are available.

Returns

  • boolean

is_rewarded_available(): boolean

Whether rewarded videos are available.

Returns

  • boolean

is_preloader_available(): boolean

Whether preloader ads are available.

Returns

  • boolean

is_sticky_playing(): boolean

Whether the sticky banner is showing.

Returns

  • boolean

is_fullscreen_playing(): boolean

Whether a fullscreen ad is playing.

Returns

  • boolean

is_rewarded_playing(): boolean

Whether a rewarded video is playing.

Returns

  • boolean

is_preloader_playing(): boolean

Whether a preloader ad is playing.

Returns

  • boolean

is_countdown_overlay_enabled(): boolean

Whether a countdown overlay shows before a fullscreen ad.

Returns

  • boolean

is_rewarded_failed_overlay_enabled(): boolean

Whether an overlay shows when a rewarded video fails to play.

Returns

  • boolean

can_show_fullscreen_before_gameplay(): boolean

Whether the platform allows a fullscreen ad before gameplay starts.

Returns

  • boolean

show_fullscreen(callback?: (result: boolean) => void, parameters?: Record<string, unknown>)

Shows a fullscreen ad.

Parameters

  • callback?: (result: boolean) => void — Receives whether the ad was shown.
  • parameters?: Record<string, unknown> — The ad options, or nil for the defaults.

show_preloader(callback?: (result: boolean) => void)

Shows a preloader ad.

Parameters

  • callback?: (result: boolean) => void — Receives whether the ad was shown.

show_rewarded_video(callback?: (result: boolean) => void, parameters?: Record<string, unknown>)

Shows a rewarded video. Grant the reward when callback receives true, or in callbacks.rewarded_reward.

Parameters

  • callback?: (result: boolean) => void — Receives whether the video was watched to the reward.
  • parameters?: Record<string, unknown> — The ad options, or nil for the defaults.

show_sticky(callback?: (result: boolean) => void)

Shows the sticky banner.

Parameters

  • callback?: (result: boolean) => void — Receives whether the banner was shown.

refresh_sticky(callback?: (result: boolean) => void)

Refreshes the sticky banner.

Parameters

  • callback?: (result: boolean) => void — Receives whether the banner was refreshed.

close_sticky(callback?: () => void)

Closes the sticky banner.

Parameters

  • callback?: () => void — Called when the banner is closed.

Variables

callbacks: AdsCallbacks

The ad event handlers.

Types

AdsCallbacks

AdsCallbacks.start?: () => void

An ad of any kind started.

AdsCallbacks.close?: (success: boolean) => void

An ad of any kind closed.

AdsCallbacks.fullscreen_start?: () => void

A fullscreen ad started.

AdsCallbacks.fullscreen_close?: (success: boolean) => void

A fullscreen ad closed.

AdsCallbacks.preloader_start?: () => void

A preloader ad started.

AdsCallbacks.preloader_close?: (success: boolean) => void

A preloader ad closed.

AdsCallbacks.rewarded_start?: () => void

A rewarded video started.

AdsCallbacks.rewarded_close?: (success: boolean) => void

A rewarded video closed.

AdsCallbacks.rewarded_reward?: () => void

The player earned the reward for watching a rewarded video.

AdsCallbacks.sticky_start?: () => void

The sticky banner started.

AdsCallbacks.sticky_render?: () => void

The sticky banner rendered.

AdsCallbacks.sticky_refresh?: () => void

The sticky banner refreshed.

AdsCallbacks.sticky_close?: () => void

The sticky banner closed.

On this page