MZ Help making a State that'll remove itself after you take or deal Fire damage

I want to make a state that'll remove itself after you take damage of a certain element, and another state that removes itself after you deal damage of a certain element. I'm using Visustella plugins, and the Battle Core has the <JS Post-Damage as User> and <JS Post-Damage as Target> notetags which let me write code in a state that'll execute after the damage of a skill is dealt.
Spoiler: notetags
<JS Post-Damage as User>
code
code
code
</JS Post-Damage as User>

<JS Post-Damage as Target>
code
code
code
</JS Post-Damage as Target>

- Used for: Actor, Class, Weapon, Armor, Enemy, State Notetags
- Runs JavaScript code after damage is dealt aimed at the function:
Game_Action.prototype.executeDamage()
- 'Post' runs after the function runs.
- If used on trait objects, this will apply to any skills/items used as long
as the unit affected by the trait object has access to the trait object.
- If the 'as User' notetag variant is used, this code will be run as a
response to the action from the action user end.
- If the 'as Target' notetag variant is used, this code will be run as a
response to the action from the action target end.
- Replace 'code' with JavaScript code to run desired effects.
- The 'user' variable represents the one using the skill/item.
- The 'target' variable represents the one receiving the skill/item hit.

Now I need to figure out the code. I want one State to be "if you took Fire damage, remove this state", and the other to be "if you dealt Fire damage remove this state". But I don't know the vocabulary. How would I check for the element of the damage? And how would I remove the state?
Moved to: JS/Plugin Support

Original thread: https://forums.rpgmakerweb.com/threads/help-making-a-state-thatll-remove-itself-after-you-take-or-deal-fire-damage.131440/