No law names the device, but pointing one at an animal you do not own creates cruelty, nuisance and trespass exposure. And you cannot see what it does.
Curtains and window inserts do two different jobs for a dog that barks at the window: one adds mass, the other removes the trigger. Here is which you need.
A door sweep is the cheapest fix for barking that escapes into the hallway. Two vendors quote wildly different numbers for it. Here is which one holds up.