Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

Commented Unassigned: setTimeout fails after upgrade [93]

0
0
I just upgraded from version 5.4.2 to 5.4.3 and script code that once worked now fails with the error "Object doesn't support this property or method". I am using V8.

I added a host object that is a Timer
```
Engine.AddHostType("ScriptTimer", GetType(ScriptTimer))
```

My ScriptTimer looks like this (VB.Net)
```
Public Module ScriptTimer
Public Function Create(func As Object, delay As Double, period As Double, args As Object)
Try
Dim callback As System.Threading.TimerCallback = New System.Threading.TimerCallback(
Sub()
Try
func.apply(Nothing, args)
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
End Sub)
Return New System.Threading.Timer(callback, Nothing, Convert.ToInt64(delay), Convert.ToInt64(period))
Catch ex As Exception
Console.WriteLine(ex.Message)
Return ex
End Try
End Function
End Module
```

And this is the script that fails.
```
function createTimer(periodic, func, delay) {
var period = periodic ? delay : -1;
var args = Array.prototype.slice.call(arguments, 3);
return ScriptTimer.Create(func, delay, period, args);
}

setTimeout = createTimer.bind(null, false);
```
Comments: I have it solved. I had changed my code to use JScript instead of V8. When I put it back to V8 everything worked fine. Sorry for the confusion. BTW: Should this same setTimeout function work in the ClearScript JScript engine?

Viewing all articles
Browse latest Browse all 2297

Latest Images

Trending Articles





Latest Images