chore: add standalone function deprecation helper (#16782)

This commit is contained in:
Shelley Vohr 2019-02-08 09:50:11 -08:00 committed by GitHub
parent c8282efb75
commit e790dbd737
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 3 deletions

View file

@ -35,6 +35,14 @@ const deprecate = {
}
},
function: (fn, newName) => {
const warn = warnOnce(fn.name, newName)
return function () {
warn()
fn.apply(this, arguments)
}
},
event: (emitter, oldName, newName) => {
const warn = newName.startsWith('-') /* internal event */
? warnOnce(`${oldName} event`)