greenworks
is an EventEmitter, which is responsible for listening Steam events.
var greenworks = require('greenworks');
// Required to do initialized stuff before using greenworks' APIs.
greenworks.init();
function log(msg) {
console.log(msg);
}
greenworks.on('game-overlay-activated', function(is_active) {
if (is_active)
log('game overlay is activated');
else
log('game overlay is deactivated');
});
greenworks.on('steam-servers-connected', function() { log('connected')});
greenworks.on('steam-servers-disconnected', function() { log('disconnected')});
greenworks.on('steam-server-connect-failure', function() { log('connected failure')});
greenworks.on('steam-shutdown', function() { log('shutdown')});
Returns:
is_active
Boolean: Indicates whether the game overlay is shown or hidden.
Emitted when game overlay activates or deactivates.
Emitted when a game is connected to Steam server.
Emitted when a game is disconnected to Steam server.
Emitted when a game is failed to connect to Steam server.
Emitted when Steam client is going to shutdown.
Emitted when a friends' status changes (Use with
greenworks.requestUserInformation
).
Emitted when a large avatar is loaded in from a previous
getLargeFriendAvatar()
if the image wasn't already available.
Returns:
steam_id
String: a 64-bits steam ID.message_id
Integer
Emitted when a chat message has been received from a user.
Returns:
dlc_app_id
Integer: The APPID of a DLC.
Emitted after the user gains ownership of DLC & that DLC is installed.
Returns:
app_id
Integer: AppID for this microtransaction.ord_id
String: a 64-bits OrderID provided for the microtransaction.authorized
Boolean: if user authorized transaction.
Emitted after a user has responded to a microtransaction authorization request.
Emitted after lobby creation attempt.
Returns:
m_eResult
Integer: lobby creation result.m_ulSteamIDLobby
String: the Steam ID of the Lobby.
Emitted when lobby metadata changes.
Returns:
m_ulSteamIDLobby
String: the Steam ID of the Lobby.m_ulSteamIDMember
String: Steam ID of either the member whose data changed, or the room itself.m_bSuccess
Boolean: whatever the lobby data was successfully changed.
Emitted upon attempting to enter a lobby. Lobby metadata is available to use immediately after receiving this.
Returns:
m_ulSteamIDLobby
String: the Steam ID of the Lobby.m_rgfChatPermissions
Integer: unused - always 0.m_bLocked
Boolean: if true, then only invited users may join.m_EChatRoomEnterResponse
Integer: This is actually a EChatRoomEnterResponse value. This will be set to k_EChatRoomEnterResponseSuccess if the lobby was successfully joined, otherwise it will be k_EChatRoomEnterResponseError.
Emitted on invite received.
Returns:
m_ulSteamIDUser
String: Steam ID of the person that sent the invite.m_ulSteamIDLobby
String: Steam ID of the lobby we're invited to.m_ulGameID
String: Game ID of the lobby we're invited to.
Emitted when the user tries to join a lobby from their friends list or from an invite. The game client should attempt to connect to specified lobby when this is received.
Returns:
m_steamIDLobby
String: the Steam ID of the lobby to connect to.m_steamIDFriend
String: the friend they joined through. This will be invalid if not directly via a friend.