Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

Conversation

@Nanonid
Copy link

@Nanonid Nanonid commented Jul 4, 2016

#28 Simple example of setTimeout. My pull adds the unfortunate CharkaCore.dll for those who don't build it. This pull also uses .net 3.5, so is more for reference.

@liminzhu
Copy link
Member

liminzhu commented Jul 7, 2016

Thanks @Nanonid! We did have a settimeout implementation in a C++ sample, but one for .NET would certainly be useful and I like the idea of adding a proper .gitignore. @Yongqu would you mind taking a look at this?

int after = (int)Math.Max(afterValue.ToDouble(), 1.0);
TimeoutCall to = new TimeoutCall(after, callbackValue, callee);
timeouts.Add(to.dt,to);
return JavaScriptValue.Invalid;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a note indicating that return value cannot be used as cookie for clearTimeout.
It would be nice if we can hide the dt as getter/setter.

@Kureev
Copy link

Kureev commented Aug 26, 2016

Hello everyone,

I think setTimeout is a bit outside of scope for ChakraCore.
It's usually implemented on the browser engine.

What do you think?

@liminzhu
Copy link
Member

@Kureev you're absolutely right that setTimeout is a Web API and is outside the scope of JavaScript. It is supplemented by the host (browser, Node, etc) and that's why ChakraCore doesn't support that right out of the box. That said, it's an useful function (another example is console.log) for many hosts, therefore I can see providing an example implementation in the host sample as helpful.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants