From ad9c2547309b765a9810184eec9c29edced6267f Mon Sep 17 00:00:00 2001 From: Ming Luo Date: Thu, 14 Jan 2016 09:27:24 -0500 Subject: [PATCH] Styled the removeListener & removeAllListeners They were previously not written with the same style as other parts of the doc. Also there was a couple grammar errors --- docs/api/ipc-main.md | 22 +++++++++++----------- docs/api/ipc-renderer.md | 17 ++++++++--------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/docs/api/ipc-main.md b/docs/api/ipc-main.md index 87430e7e9966..337d86be217b 100644 --- a/docs/api/ipc-main.md +++ b/docs/api/ipc-main.md @@ -53,12 +53,8 @@ The `ipcMain` module has the following method to listen for events: * `channel` String - The event name. * `callback` Function -When the event occurs the `callback` is called with an `event` object and a -message, `arg`. - -Once done listening for messages, if you longer want to activate this callback -and for whatever reason can't merely stop sending messages on the channel, you -can use: +When the event occurs the `callback` is called with an `event` object and +arbitrary arguments. ### `ipcMain.removeListener(channel, callback)` @@ -66,17 +62,21 @@ can use: * `callback` Function - The reference to the same function that you used for `ipcMain.on(channel, callback)` -Alternatively, if you don't have access to the same callback, you can use: +Once done listening for messages, if you no longer want to activate this +callback and for whatever reason can't merely stop sending messages on the +channel, this function will remove the callback handler for the specified +channel. ### `ipcMain.removeAllListeners(channel)` * `channel` String - The event name. -This has the expected effect of removing *all* handlers to this ipc channel. +This removes *all* handlers to this ipc channel. -Because of this class' inheritance from the `EventEmitter` node class, you can -also use `ipcMain.once(channel, callback)` to fire handlers meant to occur only -once, as in, they won't be activated after one call of `callback` +### `ipcMain.once(channel, callback)` + +Use this in place of `ipcMain.on()` to fire handlers meant to occur only once, +as in, they won't be activated after one call of `callback` ## IPC Event diff --git a/docs/api/ipc-renderer.md b/docs/api/ipc-renderer.md index d88b477ea714..090fd1a9119d 100644 --- a/docs/api/ipc-renderer.md +++ b/docs/api/ipc-renderer.md @@ -20,28 +20,27 @@ The `ipcRenderer` module has the following method to listen for events: When the event occurs the `callback` is called with an `event` object and arbitrary arguments. -Once done listening for messages, if you longer want to activate this callback -and for whatever reason can't merely stop sending messages on the channel, you -can use: - ### `ipcRenderer.removeListener(channel, callback)` * `channel` String - The event name. * `callback` Function - The reference to the same function that you used for `ipcRenderer.on(channel, callback)` -Alternatively, if you don't have access to the same callback, you can use: +Once done listening for messages, if you no longer want to activate this +callback and for whatever reason can't merely stop sending messages on the +channel, this function will remove the callback handler for the specified +channel. ### `ipcRenderer.removeAllListeners(channel)` * `channel` String - The event name. -This has the expected effect of removing *all* handlers to this ipc channel. +This removes *all* handlers to this ipc channel. -Because of this class' inheritance from the `EventEmitter` node class, you can -also use `ipcRenderer.once(channel, callback)` to fire handlers meant to occur only -once, as in, they won't be activated after one call of `callback` +### `ipcMain.once(channel, callback)` +Use this in place of `ipcMain.on()` to fire handlers meant to occur only once, +as in, they won't be activated after one call of `callback` ## Sending Messages