mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
refactor: deprecate ServiceWorker APIs (#16732)
This commit is contained in:
@@ -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`
|
||||
|
||||
Reference in New Issue
Block a user