Update adapter.js

Is's better access local variables than global