+1  A: 

is XService.poll a 'function' and 'XService.pollInterval' a number at that specific time?

Edit: Since you posted the code just now..

setInterval(

    function() {
        XService.poll();
    }, XService.pollInterval

);
meder
Yes.
Alex
Are you getting any errors?
meder
Can we see the whole code for XService? It may have to do with the way it's being defined and in regards to realtime/runtime behaviors and how eval is executed differently.
meder
Posted the XService code
Alex
A: 

What the function is bound to changes.

When you call the first, your 'this' statement is bound to XService object. When you call the second, your 'this' statement is bound to the window object.

for example, say we have XService with poll like this

function poll(){ alert(this); }

if the first example, it will alert the XService object, but in the second example it will alert the window object.

I don't know the syntax except for in mootools, but in mootoos you would call

setInterval(XService.poll.bind(XService), 100)

and it would call the method correctly

Gordon Tucker
Ahhhhh the this statement in the poll function is the culprit then I guess!
Alex
Doing what CMS said will work and will fix the binding issues (using an anonymous function)
Gordon Tucker