This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
// Observed in Node v4.5.0 and v5.0.0 | |
// Does not appear to affect Node versions >= 6.x | |
const Thing = function(input) { | |
this.value = input; | |
Object.defineProperty(this, 'nonEnum', {value: 'this should not serialize'}); | |
}; | |
Thing.prototype.nonEnum = 'Overwrite the nonEnum to trigger the bug'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server.register(plugin, registrationOptions, (err) => { | |
if (err) { | |
console.log('Plugin registration error. Deal with it.'); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
await server.register(plugin, registrationOptions); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const register = (server, options, next) => { | |
// Do your registration stuff | |
return next(); | |
}; | |
register.attributes = { | |
name: 'pluginName', | |
version: '1.0.1' | |
}; | |
server.register({ register }, () => {}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const register = async (server, options) => { | |
// Do your registration stuff | |
}; | |
const plugin = { | |
register, | |
name: 'pluginName', | |
version: '1.0.1' | |
}; | |
try { | |
await server.register(plugin); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server.register({ register, select: ['web'] }, () => {}); | |
// OR | |
server.register({ register }, { select: ['web'] }, () => {}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
await webServer.register(plugin1); | |
await adminServer.register(plugin2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const register = (server, options, next) => { | |
// Do your registration stuff | |
return next(); | |
}; | |
register.attributes = { | |
name: 'pluginName', | |
version: '1.0.1' | |
}; | |
const plugin = { | |
register, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const plugin = { | |
register: async (server, options) => { | |
// Do your registration stuff | |
}, | |
name: 'pluginName', | |
version: '1.0.1', | |
once: true, | |
options: {} | |
}; | |
try { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
register: { | |
plugins: [ | |
'myPlugin', | |
{ plugin: 'plugin2' }, | |
{ plugin: require('finalPlugin') } | |
] | |
} | |
} |
OlderNewer