max-mapper / max-mapper/electron-microscope
outputstream emits no data
Open
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 154
- Forks
- 14
- PR merge metrics
- No merged PRs in 30d
Description
i'm using the following code snippet with node v5.11.0, electron v1.4.13 and electron-microscope v2.0.0
I hope i'm not using it wrong. I'd be happy for a hint why the output$ stream is not logging anything.
var electron = require('electron')
var createMicroscope = require('electron-microscope')
electron.app.on('ready', function () {
createMicroscope(function (err, scope) {
if (err) throw err
var url = 'http://google.de'
var code = '(function () { return document.title || "m3h" })()'
var microscope = scope.window.webContents
function cb (result) { console.log(result) }
scope.loadURL(url, function () {
microscope.executeJavaScript(code, false, cb)
var CODE = `function (send, done) {
// put your custom code here
// call 'send(data)' to write data to the stream
// call 'done()' to end the stream
// calling send is optional, but you must eventually call done to end the stream
send(document.title)
send('asdf')
done()
}`
var output$ = scope.run(CODE)
// @TODO: `output$` emits no data :/
output$.on('data', function (data) { console.log('data: ',arguments) })
output$.on('error', function (err) { console.error(err) })
})
})
})
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the provided Node, Electron, and electron-microscope snippet, especially the call to scope.run(CODE) and its output$ data listener. Compare the observed stream behavior with the expected document title and "asdf" values; done means determining why the stream emits no data and documenting or fixing that behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- electron, javascript
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100