adding threadsafe call to js callback