browserify / browserify/vm-browserify

setTimeout is not working

Open
#24 10 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
205
Forks
41
PR merge metrics
No merged PRs in 30d

Description

setTimeout, setInterval and other interval built in methods do not work, even if I expose them in context.
```
console.log('start');
setTimeout(()=> {
console.log('hello timeout');
}, 2000);

console.log('end');
```
**output:**
```
start
end
```

It is to be noted that when I add `.bind(this)` , then timeout works and breaks at that line saying .bind is not a function.
```
console.log('start');
setTimeout(()=> {
console.log('hello timeout');
}, 2000).bind(this);

console.log('end');
```
**output:**
```
start
hello timeout
// and an error in console saying setTimeout(...).bind is not a function
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.