how to make Gulp stop watching files - javascript

How do you stop files from being watched?
I have not seen the method in the docs which seems a bit odd to me.

It's not a gulp thing. Gulp is just running as a never ending process.
The way to abort a process is Ctrl+C.

According the official document. you can using returned stream method to stop it.
let watchStream = gulp-watch(paths, function(){})
watchStream.close()

If you are using Visual Studio 'Package Manager Console' just press red square button inside that window.

Related

How do I disable console.log for loaded javascript modules in HTML?

In my HTML I load a Javascript module like this:
<script type="text/javascript" src="static/js/mymodule.js"></script>
But mymodule.js contains console.log commands inside so I can see their outputs every time when I reload the page. How can I prevent it?
Of course, I could remove all console.log calls, but what if I deal with external library that I can't modify? Maybe there's a way to prevent logging in a particular script-tag.
I don't think there is a way to do that (I hope I'm wrong). If an external library has console.logs in their production code, you should consider using an alternative one.
Because you have control of the file where the console.log exists, you should delete it or comment it out.
try this :
console.log = function () {}
You can do that by: stripping out the console.log statements using build tool settings. Enable the build tool settings to strip console.log for production build whereas you can still keep them for development build.
Most of the build tools have support for this. e.g webpack, gulp etc.

how can i turn off the debug view in electron?i cant find any about it using google

every time i run my electron app,it starts like this!
always turn the front-end elements view,how can i start my app without this show on GUI?
besides,why it goes with black bg? it went well on chrome.
thank u,guys
The black screen is probably due to the css files routes. Check them.
If you followed the starter electron tutorial, you are most likely calling mainWindow.openDevTools();. Remove that line and you will not get the console.
Check if your code is calling openDevTools().
Just comment the below code
win.webContents.openDevTools()
to
// win.webContents.openDevTools()
For me, the bug was with npm caching some sort of preference. Even when I got rid of "openDevTools()", the problem persisted. To fix the problem, I removed my node_modules folder, and re-ran "npm install", and from there everything worked just fine.

emscripten_run_script() removed in optimised build

In my .cpp file I have a line:
emscripten_run_script("callOut();console.error('Hello');");
This function callOut just writes a message to the console so that I know it has been called.
This all works fine when building with -g4, but doesn't do anything when compiled with the recommended for release -O2. I can't even find the text "hello" in the javascript output.
Is it supposed to work like this? Is there any way I can get this call in the release build?
The problem was that I wasn't waiting for the emscripten code to be fully initialized before calling in to it. You should wait until the emscripten main() function gets called, then you know it is ready.
The problem is made worse when using -O2 as emcc creates a separate memory initialization file that must be loaded before the is emscripten code is ready.
An alternative to emscripten_run_script is to use the EM_ASM macros. I've never had trouble with these disappearing in optimized builds.
So your example would be equivalent to
EM_ASM({
callOut();
console.error("Hello");
});

Confirmation before running a Grunt task

I have a task in Gruntfile.js which can potentially wipe my project and I want to protect it with a "Are you sure you want to run this task?" question before running it, just to be safe. Something like:
grunt.registerTask('install', 'Run this only once when starting a project!', function() {
console.log('Are you sure? Y/n:');
// If yes, continue with task
grunt.task.run('copy_install');
});
But I don't know how to make it wait for keyboard input and read the input. Could not find this documented either.
Don't do it! You will regret this!
Grunt is a build tool and you grunt script should only be able to wipe what it created. No matter what the reasoning behind your current state is, change it. Use the tool for what is was meant to do, not for wiping stuff you dont want to lose.
Take a look at grunt-prompt or grunt-confirm.

is there anything like robotium's solo.clickOnText in MonkeyTalk?

does anyone know if there is a similar command to robotium's
solo.clickOnText within MonkeyTalk?
or how to do the same with javascript?
thanks for your help.
Update:
I have found in monkeyTalk syntax - to tap on any component labeled "ok"
View OK Tap
but for some reason the script says it has run ok, but nothing happens on the app.
When I record the action with the recorder it uses the
Table ITEM selectIndex 1
with the same result.
This is a native Android app and the solo.clickOnText command works well with Robotium, but we were wanting to try MonkeyTalk as it is quicker to record.
Robotium now also supports recording http://robotium.com/

Categories