javascript - Straightforward Way to Extend Class in Node.js -
i moving plain javascript class node.js. in plain javascript use:
class blockmosaicstreamer extends mosaicstreamer{ }
i can't seem find simple way implement in node.js. in node project in blockmosaicstreamer.js
have:
'use strict'; function blockmosaicstreamer(){ }
how extend mosaicstreamer
in ./mosaicstreamer.js
?
'use strict'; function mosaicstreamer(){ }
it depends how defined first class, suggest using this:
class someclass { } module.exports = someclass
then in extend:
const someclass = require('./dir/file.js') class mynewclass extends someclass { } module.exports = mynewclass
Comments
Post a Comment