Inspect Event Listeners in Electron - electron

I would like to inspect Event Listeners in an Electron app.
There is meant to be a plugin for electron that does this:
https://www.electronjs.org/devtron
However it's unmaintained and we're getting this error
Uncaught ReferenceError: require is not defined
Does anyone know of an alternative method of inspecting Event Listeners?
Thank you!

Related

How can I make console.log() work in a Vue-cli app?

I am trying to add a console.log() call in my vue-cli app to support debugging. Here's an excerpt from my template
<v-btn v-on:click.native="console.log('start button clicked')"
color="primary rounded-pill">
Start
</v-btn>
However, when I run the app on localhost, I get the following message in the console:
vue.runtime.esm.js?2b0e:619 [Vue warn]: Property or method "console"
is not defined on the instance but referenced during render. Make sure
that this property is reactive, either in the data option, or for
class-based components, by initializing the property.
I reviewed How enable console log in VUE-CLI during development, but it didn't seem to apply to my case, as I am not using eslint, and there is no eslintConfig section in my package.json file.
Any idea what else could be going on?
Try adding "this" so it would look like: this.console.log()
just make a vue method and call it on click

DOM ready event inside Electron how?

This is a silly question, but I could not find a clear answer on the web.
Do I need to listen to a special "dom-ready-event" if my app is running within a BrowserWindow in Electron? For instance in a Cordova/PhoneGap app I read you can start doing things after the deviceready event.
I would like to know how this is done in Electron? Is one of the following enough?
document.addEventListener("DOMContentLoaded", startApp);
window.addEventListener("load", startApp);
Thank you.
Cordova has deviceready because it has both native code and JavaScript code, and potentially JavaScript might run before the native code has finished loading.
You don't have the same problem in Electron. You have a main process (main.js) which creates your BrowserWindow, so by the time any client-side JavaScript is running, your main process has definitely already started because it was the thing that created your browser window in the first place!
Inside the browser window the same events fire as they would on a normal webpage. So if you wanted to, you could use DOMContentLoaded or load (for the difference see this article on MDN), just in the same way as you would for a regular web application. But you certainly don't need to before calling any of the Electron APIs.

Access DOM from capybara-webkit #execute_script?

So I'm trying to test that the jQueryUI sortable library triggers an ajax request and I haven't been successful at triggering it, I've tried this with the jquery.simulate.drag-sortable.js library, but to no avail. I've also tried it with the execute script function, also to no avail. I am trying to manually trigger the sortable deactivate event because jQuery.trigger() doesn't seem to work with it even in the browser. The script that is executed is $sortable.sortable("option", "deactivate")(event, ui) with event and ui properly injected, this code works when I enter it directly into the browser.
The problem seems to stem from not being able to access the DOM. When I enable the debug mode on the driver the error is TypeError: '[object Object]' is not a function (evaluating '$sortable.sortable("option", "deactivate")(event, ui)'). Digging a little deeper reveals that the Javascript driver can't access DOM nodes within #execute_javascript. When I enter console.log(document.getElementById('sortable')); The response is 'null'.
Any thoughts on how to trigger the jQueryUI sortable function with the deactivate event using capybara-webkit?

"Uncaught Reference Error: Polymer is not defined" caused by IP-change?

so I didn't touch my current project for almost one month and after that, nothing is running anymore and I get the message
Uncaught Reference Error: Polymer is not defined
for each of my Polymer-Elements and this one once:
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:9000/bower_components/tools/loader/loader.js
Uncaught ReferenceError: PolymerLoader is not defined
I have Polymer included in my main html-file like this:
<script src="bower_components/polymer/polymer.js"></script>
I already deleted and reinstalled all my bower_components, downloaded Polymer directly from GitHub and added the PolymerLoader manually to the referenced directory(deleted it again after it did not work).
I am unsing Version 0.0.20131010 of Polymer (I know it's very old, but it used to work before...) and the newest version of Bower.
I can't find an explanation for all this.
The only thing that has changed is the IP-address of the computer, which I am not refering to anywhere in my code.
I hope you could share some of your thoughts on this with me.
Something is wrong / misconfigured with the HTTP server that's serving these files out. It's not a polymer error if you're getting a 404 for the .js files.
Please ask a new question and include information about the tools that you're using to serve out HTTP.

DOM ready in Dartium

Calling focus() inside main() doesn't stick when Dartium is first run (OS X via Dart Editor). There is something async going on that changes focus to the URL bar. Works if Dartium already running. Is there some event I can hook to reliably set focus? Thanks.
Based on the comments in Issue 12283, seems like this would require changes in Chrome to fix. It's not clear if it's a bug, or missing feature, but I think the chances of it being addressed are probably slim :-/

Resources