javascript - Instance Creation ( JS ) -



javascript - Instance Creation ( JS ) -

i've been reading substack modules , notice style of creating new instace of object.

if (!(this instanceof browserify)) homecoming new browserify(files, opts); https://github.com/substack/node-browserify/blob/master/index.js#l37

i know this in "this" particular case refers window obj, , browserify wont instance of (window).

my question : thoughts way or style creating object ? / convenient way of instantiating object without having do. var brows = require('browserify') , var x = new brows()

effectively prevents calling constructor without returning instance of object, or eliminates need utilize new keyword. next same thing:

var brs = new browserify(); var brs = browserify();

brs instantiated browserify object either way.

as why or necessary -- think matter of sentiment more else.

javascript node.js browserify

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -