Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support full Electron API #18

Merged
merged 80 commits into from
Apr 26, 2016
Merged

Support full Electron API #18

merged 80 commits into from
Apr 26, 2016

Conversation

kevinsawicki
Copy link
Collaborator

@kevinsawicki kevinsawicki commented Apr 25, 2016

When this library started, I was adding helper commands as I needed them to assert specific things for the tests I was trying to write.

This worked fine but isn't really a sustainable way to build this library going forward. To get 100% Electron API coverage via this approach would be tedious and it would be falling behind as the APIs were updated.

This pull request introduces support for the entire Electron API by dynamically generating it when the app is started. This is exposed through 5 new top-level properties:

  • browserWindow which is an alias to require('electron').remote.getCurrentWindow()
  • webContents which is an alias to require('electron').remote.getCurrentWebContents()
  • electron which is an alias to require('electron')
  • mainProcess which is an alias to require('electron').remote.process
  • rendererProcess which is an alias to global.process in the browser window

Before

app.client.getWindowBounds()
app.client.setClipboardText('pasta')

After

app.browserWindow.getBounds()
app.electron.clipboard.readText('pasta')

This pull request will remove the old helper breaking backwards compatibility and so the major will be bumped in the next release after this is merged.

Remaining Tasks

  • Remove old manually created command wrappers
  • Update docs
  • Update remaining specs

/cc @zeke

@kevinsawicki kevinsawicki merged commit 2607719 into master Apr 26, 2016
@kevinsawicki kevinsawicki deleted the full-api branch April 26, 2016 22:02
@zeke
Copy link
Member

zeke commented Apr 26, 2016

💃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants