Added option for using addImmediateCallback() from JavaScript API.

Change-Id: Icb4f006c95c09a7dab3ede076051bc0f666184f4