It should be possible since ESP8266 has got an interrupt input, see this thread and link:
It sounds like every ESP8266 pin can be used in interrupt mode:
Pin interrupts are supported through attachInterrupt, detachInterrupt functions. Interrupts may be attached to any GPIO pin, except GPIO16. Standard Arduino interrupt types are supported: CHANGE, RISING, FALLING.