How does SDL_Joystick work ?

Does SDL_Joystick set its data (button, axis etc…) based on events or does it poll from the operating system ?

This is in relation to uint8 SDL_JoystickGetButton(..., ...); function