PJRC encoder library outside of loop

I want to use PJRC encoder library WITHOUT chcecking encoder state in loop, only in function.
Any practical directions? Should I expect any problems? Of course encoder connected to pins 2,3 on Nano board.
I need only return "direction" (I mean +1 or -1) when I turn an encoder.