defold/extension-firebase-remoteconfig/firebase-remoteconfig
Functions and constants for interacting with Firebase
- GitHub: defold/extension-firebase-remoteconfig — pinned to
2.3.1(released while Defold 1.13.1 was current)- Pick a release from defold/extension-firebase-remoteconfig releases and add its Source code (zip) URL (or a packaged
.zipasset, if the library ships one) togame.projectunder[project]dependencies, then Fetch Libraries in the Defold editor. - Run
bunx @defold-typescript/cli resolveto materialize its types. - Import it under a namespace alias of your choice:
import * as firebase from "firebase"
- Pick a release from defold/extension-firebase-remoteconfig releases and add its Source code (zip) URL (or a packaged
Functions
firebase.remoteconfig.initialize()firebase.remoteconfig.set_callback(callback: function)firebase.remoteconfig.fetch()firebase.remoteconfig.activate()firebase.remoteconfig.fetch_and_activate()firebase.remoteconfig.add_update_listener()firebase.remoteconfig.remove_update_listener()firebase.remoteconfig.get_boolean(key: string): booleanfirebase.remoteconfig.get_data(key: string): stringfirebase.remoteconfig.get_number(key: string): numberfirebase.remoteconfig.get_string(key: string): stringfirebase.remoteconfig.get_keys(): tablefirebase.remoteconfig.set_defaults(defaults: table)firebase.remoteconfig.set_minimum_fetch_interval(minimum_fetch_interval: number)firebase.remoteconfig.set_timeout(timeout: number)
firebase.remoteconfig.initialize()
Initializes Firebase Remote Config. Generates MSG_INITIALIZED or MSG_ERROR
firebase.remoteconfig.set_callback(callback: function)
Sets a callback function for receiving events from the SDK. Call firebase.remoteconfig.set_callback(nil) to remove callback
Parameters
callback:function— Callback function that is executed on any event in the SDK.self:object— The calling script instancemessage_id:number— One of message types:firebase.remoteconfig.MSG_ERRORfirebase.remoteconfig.MSG_INITIALIZEDfirebase.remoteconfig.MSG_DEFAULTS_SETfirebase.remoteconfig.MSG_SETTINGS_UPDATEDfirebase.remoteconfig.MSG_FETCHEDfirebase.remoteconfig.MSG_ACTIVATEDfirebase.remoteconfig.MSG_CONFIG_UPDATEDmessage:table— A table holding the dataerror?:string— The error message (if an error occurred ornilotherwise)updated_keys?:table— An array of strings representing the updated parameter keys forMSG_CONFIG_UPDATED
firebase.remoteconfig.fetch()
Fetches config data from the server. Generates MSG_FETCHED or MSG_ERROR
firebase.remoteconfig.activate()
Asynchronously activates the most recently fetched configs, so that the fetched key value pairs take effect. Generates MSG_ACTIVATED or MSG_ERROR
firebase.remoteconfig.fetch_and_activate()
Asynchronously fetches and then activates the fetched configs. Generates MSG_FETCHED and MSG_ACTIVATED or MSG_ERROR
firebase.remoteconfig.add_update_listener()
Starts listening for real-time config updates from Remote Config. Generates MSG_CONFIG_UPDATED or MSG_ERROR. Real-time updates automatically fetch new values but do not activate them; call activate() when the updated values should take effect.
firebase.remoteconfig.remove_update_listener()
Stops the active real-time config update listener.
firebase.remoteconfig.get_boolean(key: string): boolean
Returns the value associated with a key, converted to a bool.
Parameters
key:string— Key of the value to be retrieved
Returns
value:boolean— The value
firebase.remoteconfig.get_data(key: string): string
Returns the value associated with a key, as a vector of raw byte-data.
Parameters
key:string— Key of the value to be retrieved
Returns
value:string— The value
firebase.remoteconfig.get_number(key: string): number
Returns the value associated with a key, converted to a double.
Parameters
key:string— Key of the value to be retrieved
Returns
value:number— The value
firebase.remoteconfig.get_string(key: string): string
Returns the value associated with a key, converted to a string.
Parameters
key:string— Key of the value to be retrieved
Returns
value:string— The value
firebase.remoteconfig.get_keys(): table
Gets the set of all keys.
Returns
keys:table— An array of strings representing parameter keys
firebase.remoteconfig.set_defaults(defaults: table)
Sets the default values. Generates MSG_DEFAULTS_SET or MSG_ERROR
Parameters
defaults:table— Key-value pairs representing the default values
firebase.remoteconfig.set_minimum_fetch_interval(minimum_fetch_interval: number)
Sets the minimum fetch interval. Generates MSG_SETTINGS_UPDATED or MSG_ERROR
Parameters
minimum_fetch_interval:number— The minimum interval in seconds between successive fetch calls
firebase.remoteconfig.set_timeout(timeout: number)
Sets the timeout that specifies how long the client should wait for a connection to the Firebase Remote Config servers. Generates MSG_SETTINGS_UPDATED or MSG_ERROR
Parameters
timeout:number— The timeout interval in seconds
Constants
firebase.remoteconfig.MSG_INITIALIZED
Event generated when remote config has been initialized and is ready for use
firebase.remoteconfig.MSG_ERROR
Event generated when an error occurred.
firebase.remoteconfig.MSG_DEFAULTS_SET
Event generated when the default values have been set
firebase.remoteconfig.MSG_FETCHED
Event generated when the remote config has been fetched
firebase.remoteconfig.MSG_ACTIVATED
Event generated when the remote config has been activated
firebase.remoteconfig.MSG_SETTINGS_UPDATED
Event generated when remote config settings have been updated
firebase.remoteconfig.MSG_CONFIG_UPDATED
Event generated when real-time Remote Config has automatically fetched updated values. The message table contains updated_keys.