overwolf.extensions.current API
Notify you when something interesting happens while playing a particular game.
The full list of supported games with their Game ID’s is always up to date and can be found here.
Please read all the info about how to use game events in your app in our using game events guide.
This API enables you to get real-time game events (kill, death, etc.) for specific games that are defined in your app's manifest, under the "game_events" section.
Regardless, you have the overwolf.games API that gives you general "game info" events about the currently running game's state (process name, focus, command line info, and more).
Methods Reference
Events Reference
- overwolf.games.events.onError
- overwolf.games.events.onInfoUpdates2
- overwolf.games.events.onNewEvents
Types Reference
- overwolf.games.events.SetRequiredFeaturesResult Object
- overwolf.games.events.GetInfoResult Object
- overwolf.windows.ErrorEvent Object
- overwolf.windows.InfoUpdates2Event Object
- overwolf.windows.NewGameEvents Object
- overwolf.windows.GameEvent Object
Sample App
You can find an example of overwolf.games.events API usage here. This one notifies whenever a relevant event has happened in League of Legends.
setRequiredFeatures(features, callback)
Version added: 0.93
Sets the required features from the provider.
| Parameter | Type | Description |
|---|---|---|
| features | string[] | String array of features to utilize |
| callback | (Result:SetRequiredFeaturesResult) => void | all available features for the registered games declared in the manifest |
Usage Example
Example for setting League of Legends required features:
var g_interestedInFeatures = [
'summoner_info',
'gameMode',
'teams',
'matchState',
'kill'
];
overwolf.games.events.setRequiredFeatures(g_interestedInFeatures, function(info) {
if (info.success == false)
{
console.log("Could not set required features: " + info.error);
return;
}
}
- it's important to wait for the success status to ensure that required features will be registered and trigger events properly.
- If your app uses a background controller, make sure to call the setRequiredFeatures function only from your background controller.
Example for setting required features and waiting for 'success':
async setRequiredFeatures() {
let tries = 1;
let result;
while ( tries <= MAX_RETRIES ) {
result = await new Promise(resolve => {
overwolf.games.events.setRequiredFeatures(FEATURES_ARRAY, resolve);
})
if ( result.success === true ) {
// make sure our required features were registered
return (result.supportedFeatures.length > 0);
}
// wait 3 sec before retry
await new Promise(resolve => {
setTimeout(resolve, 3000);
});
tries++;
}
console.warn('setRequiredFeatures(): failure after '+ tries +' tries'+ JSON.stringify(result, null, 2));
return false;
}