Add sahagin-js shared logic