sf.Event holds all the informations about a system event that just happened.
Events are retrieved using the sf.Window.pollEvent and sf.Window.waitEvent functions.
A sf.Event instance contains the type of the event (mouse moved, key pressed, window closed, ...) as well as the details about this particular event. Please note that the event parameters are defined in a union, which means that only the member matching the type of the event will be properly filled; all other members will have undefined values and must not be read if the type of the event doesn't match. For example, if you received a KeyPressed event, then you must read the event.key member, all other members such as event.mouseMove or event.text will have undefined values.
Usage example:
sf.Event event;
while (window.pollEvent(event))
{
// Request for closing the window
if (event.type == sf.EventType.Closed)
window.close();
// The escape key was pressed
if ((event.type == sf.EventType.KeyPressed) && (event.key.code == sf.KeyCode.Escape))
window.close();
// The window was resized
if (event.type == sf.EventType.Resized)
doSomethingWithTheNewSize(event.size.width, event.size.height);
// etc ...
}