Skip to content

Commit

Permalink
Add shims for legacy electron APIs
Browse files Browse the repository at this point in the history
Signed-off-by: Nathan Sobo <nathan@github.com>
  • Loading branch information
maxbrunsfeld authored and thomasjo committed Sep 7, 2016
1 parent 874b555 commit e7444b1
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 0 deletions.
7 changes: 7 additions & 0 deletions exports/ipc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = require('electron').ipcRenderer

const Grim = require('grim')
Grim.deprecate('Use `require("electron").ipcRenderer` instead of `require("ipc")`')

// Ensure each package that requires this shim causes a deprecation warning
delete require.cache[__filename]
7 changes: 7 additions & 0 deletions exports/remote.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = require('electron').remote

const Grim = require('grim')
Grim.deprecate('Use `require("electron").remote` instead of `require("remote")`')

// Ensure each package that requires this shim causes a deprecation warning
delete require.cache[__filename]
7 changes: 7 additions & 0 deletions exports/web-frame.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = require('electron').webFrame

const Grim = require('grim')
Grim.deprecate('Use `require("electron").webFrame` instead of `require("web-frame")`')

// Ensure each package that requires this shim causes a deprecation warning
delete require.cache[__filename]
7 changes: 7 additions & 0 deletions src/electron-shims.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const electron = require('electron')

electron.ipcRenderer.sendChannel = function () {
const Grim = require('grim')
Grim.deprecate('Use `ipcRenderer.send` instead of `ipcRenderer.sendChannel`')
return this.send.apply(this, arguments)
}
1 change: 1 addition & 0 deletions src/initialize-application-window.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module.exports = ({blobStore}) ->
{getWindowLoadSettings} = require './window-load-settings-helpers'
{ipcRenderer} = require 'electron'
{resourcePath, isSpec, devMode, env} = getWindowLoadSettings()
require '../src/electron-shims'

updateProcessEnv(env)

Expand Down
1 change: 1 addition & 0 deletions src/initialize-test-window.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module.exports = ({blobStore}) ->
{getWindowLoadSettings} = require './window-load-settings-helpers'
AtomEnvironment = require '../src/atom-environment'
ApplicationDelegate = require '../src/application-delegate'
require '../src/electron-shims'

{testRunnerPath, legacyTestRunnerPath, headless, logFile, testPaths} = getWindowLoadSettings()

Expand Down

0 comments on commit e7444b1

Please sign in to comment.