New to datapacks - Shield Flawless Block

Hi there! I've never actually programmed in json before, but I'm trying to make a datapack where, for the first few frames after you block with a shield, it will deal thorns damage to whatever hit you. How would I go about doing this? I've searched and searched but I just don't know what I'm doing.
Continue to help post