If you do not know - DO NOT DO IT !!!
These types of smps are incredibly dangerous!
They work by first rectifying the mains voltage to give you 240V DC , with all the energy of live main as well !
Then this is switched/pulsed into the small transformer at high (50KHz or higher) frequency.
The secondary side is rectified into a capacitor.
This voltage is measured and the difference from the setpoint voltage is fed back to adjust the frequency of the pulses.
The freq or pulse width is adjusted to keep the output voltage (or current for constant current psu) at the correct value.