Emit an event with new Guid

From within a projection I need to emit an event and assign a GUID to its explicit Id property (not the hidden messageId). Is there anyway to generate a real GUID using Javascript in projection. I’ve tried a reliable function which relies on ES6 crypto api but “crypto is undefined”.

Pls tell me if there is a workable solution.