President Obama has signed into law a measure that will require instant nationwide "Blue Alerts" to warn about threats to police officers.