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

Remove 0.37 deprecation warnings #9

Merged
merged 2 commits into from
Apr 6, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,25 @@ var assign = require('object-assign')
var path = require('path')
var BrowserWindow = require('browser-window')
var wargs = require('./args')
var v = (process.versions.electron || '').split('.').map(Number)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be a good place for the new assignment magic in ES2015:

let [major, minor, patch] = process.versions.electron.split('.').map(Number)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, absolutely! But here the code is supposed to be backwards compatible and the tests are currently run with mocha in node (so we'd have to enable --harmony_destructuring or use babel).

Besides, I would hope that these version checks can be removed soon anyway, seeing how fast Electron is moving along.


// retain global references, if not, window will be closed automatically when
// garbage collected
var _windows = {}

function _createWindow (options) {
var opts = assign({
show: false,
preload: path.join(__dirname, 'renderer-preload')
show: false
}, options)

if (v[0] === 0 && v[1] < 37) {
opts.preload = path.join(__dirname, 'renderer-preload')
} else {
opts.webPreferences = assign({
preload: path.join(__dirname, 'renderer-preload')
}, options.webPreferences)
}

var window = new BrowserWindow(opts)
_windows[window.id] = window

Expand Down