# On the use of INJECTED…

**URL:** <https://community.keyboard.io/t/on-the-use-of-injected/1930>\
**Category:** Programming\
**Created:** [August 15, 2018, 6:33am UTC](https://community.keyboard.io/t/on-the-use-of-injected/1930 "2018-08-15T06:33:37Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![jamadagni](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/jamadagni/32/2030_2.png) [@jamadagni](https://community.keyboard.io/u/jamadagni)\
**Post date:** [August 15, 2018, 1:07pm UTC](https://community.keyboard.io/t/on-the-use-of-injected/1930/4 "2018-08-15T13:07:02Z")

</div>

> [@algernon](#):
>
> The primary purpose of `INJECTED` is to prevent infinite recursion. When you inject a key from a plugin, or macro, or anywhere, via `handleKeyswitchEvent` , that runs the key event handlers for all plugins. Including the one that injected the key. In most cases, we’d like these to just go through - but not always.

So in [the thread about Ctrl+wheel for zooming](https://community.keyboard.io/t/ctrl-scroll-for-zoom-not-working-from-keyboard-but-working-from-mouse/1649/2) when you recommended a call to `handleKeyswitchEvent` but _without_ `INJECTED` that was intentional, so that MouseKeys should handle it?

I mean, is it recommended to:

1. normally use `INJECTED` in calls to `handleKeyswitchEvent` and omit it only in the case where one specifically wants other plugins to not ignore it as @merlin kindly explained for the Qukeys exception,

or

1. you normally don’t need to bother with `INJECTED` and you need to use it only in the case when you specifically need it to be ignored?

And on the side of plugins, likewise should they normally contain an `if` check to ignore injected keys or only if there will be a problem if they handle them?

(I hope I’m being clear?)

---

_[View the full topic](https://community.keyboard.io/t/on-the-use-of-injected/1930)._
