Skip to Content
defold-typescript libraries
indiesoftby

indiesoftby/defold-page-visibility/page_visibility

The Page Visibility API for Defold

  • GitHub: indiesoftby/defold-page-visibility — pinned to 1.0.0 (released while Defold 1.9.8 was current)
    1. Pick a release from indiesoftby/defold-page-visibility 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 page_visibility from "page_visibility"
  • Asset Portal: defold-page-visibility

Functions

page_visibility.set_listener(callback?: function)

Sets or removes the listener for the page visibility change event.

Parameters

  • callback?: function — The callback to be called when the page visibility changes.

page_visibility.state(): number

Returns the current state of the page visibility.

Returns

  • state: number — The current state of the page visibility.

Constants

page_visibility.STATE_VISIBLE

The page is visible.

page_visibility.STATE_HIDDEN

The page is hidden.

On this page