For instance, if you are about to go out, give them fair warning and a few reminders. Especially the all-important: if you need to save your game, you need to do it now.
Similarly, if kids are taking turns with toys, your kid might be patiently waiting their turn. To be suddenly yanked away before their turn will, quite rightly, feel like an injustice. I used to tell them all that if its someone's turn coming up that they should get to have it before we leave. Kids are usually fair in these circumstances.
These simple rules meant my kids never had leaving tantrums, and rarely had tantrums at all.