PRE REQUEST API JavaScript

how can i handle the javascript pre request