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

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -