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

refactor: deprecate ServiceWorker APIs #16732

Merged
merged 1 commit into from Feb 5, 2019
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -379,6 +379,8 @@ WebContents.prototype._init = function () {
this.setMaxListeners(0)

this.capturePage = deprecate.promisify(this.capturePage)
this.hasServiceWorker = deprecate.function(this.hasServiceWorker)
this.unregisterServiceWorker = deprecate.function(this.unregisterServiceWorker)

// Dispatch IPC messages to the ipc module.
this.on('-ipc-message', function (event, [channel, ...args]) {
@@ -69,6 +69,16 @@ const deprecate = {
})
},

function: (fn, newName) => {
// if newName is left blank, a removal warning will be displayed
const warn = warnOnce(fn.name, newName)

return function () {
if (!process.noDeprecation) warn()
return fn.apply(this, arguments)
}
},

promisify: (fn) => {
const fnName = fn.name || 'function'
const oldName = `${fnName} with callbacks`
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.