Comments (6)
We could also add a simple boolean argument to ScanJS.scan() that simply tells it whether or not we want to print to console. That might be hacky tho.
from scanjs.
We cannot use console.log inside a web worker, it causes console not defined errors.
Works for me in Firefox 29+, currently Aurora
I'll test what the spec says and come up with a solution. Happy to take this bug.
from scanjs.
Yah, I'm on FF 28.0 currently on this machine.
It does seem console.log with web workers has been a known issue for a while, but maybe browsers have updated since the articles I'm reading.
Just to be sure, you've cleared your cache?
from scanjs.
Anywho, I also don't mind turning off console.logs() for the client interface anyways and just use them in the server version, so maybe an additional parameter to scan() is the way to go but obviously whatever you think is best
from scanjs.
I don't think there's any benefit in disabling too many console.log calls. For end-users it's hidden away anyway, because you'd need to activate the devtools and then you're not just a user anymore ;)
I would suggest shimming console in the worker with something like this:
DEBUG=false;
if (typeof console === "undefined") {
console = {};
console.log = function consoleShim() {
if (DEBUG === true) {
postMessage(arguments.join(" "));
}
}
}
DEBUG is probably not the right name, as the worker will always print stuff, if console is available in the worker.
WDYT?
from scanjs.
That seems like a reasonable approach! I'd even be fine leaving out the DEBUG check and just printing, although I suppose there could be performance implications of that.
from scanjs.
Related Issues (20)
- Bug: "new foo('arg')" matches "new foo()" which results in false positives HOT 1
- Create rule with data type of argument HOT 6
- False positives for literal assignments HOT 2
- Need a better structure for JSON reports in the cmdline version. HOT 2
- JS parsing and AST generation should be easier to switch out. HOT 4
- Support for longer rules (e.g. foo.bar.baz) HOT 1
- split scanjs into separate repos for nodejs, web and just the scanning HOT 3
- Investigate and complete automated deployment gh-page updates through Travis-CI HOT 1
- experiments tab is broken
- show parse errors on experiment tab
- "use strict"; mode wherever possible
- package missing from npm registry HOT 7
- [false-positive] input-manage permission rule HOT 5
- Rule Parser Rewrite (Redux) HOT 1
- Incorrect line number reported in output json file HOT 2
- [Feature Request] Export results to HTML
- checklist: add comment/hide/delete button in output view
- Sources Rules a='b'; HOT 2
- Rule for values inside object? HOT 3
- Wiki changes
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scanjs.