Implement javascript side of native plugin