There is nothing in the context for that purpose, as far as I know, but here is a trick that can tell you if it is running in Rally, or outside:
if (window.parent.Rally.alm) {
console.log('inside');
}
else{
console.log('outside');
}