class Event extends Immutable.Record { constructor(text) { super({text: text, timestamp: Date.now()}); } }
The call to new Event() returns the constuctor function:
new Event('started').toString()
"Record (values) {if (instanceof RecordType values) {return values;}
if (! (this instance of type RecordType)) {return new RecordType (values);}
if (! hasInitialized) {hasInitialized = true; var keys = Object.keys (defaultValues); setProps (RecordTypePrototype, keys); RecordTypePrototype.size = keys.length; RecordTypePrototype._name = name; RecordTypePrototype._keys = keys; RecordTypePrototype._defaultValues = defaultValues;}
this._map = Map (values);} "
While calling the function returns the expected output:
new Event('started')().toString()
"Record {" text ":" start "," timestamp ": 1453374580203}"
What am I doing wrong?
source share