class Event extends Immutable.Record {
constructor(text) {
super({text: text, timestamp: Date.now()});
}
}
Calling new Event()
Immutable.Record "Creates a new Class which produces Record instances.", in other words it's a function in itself which you pass the allowed keys and returns a class you can extend;
class Event extends Immutable.Record({text:'', timestamp:''}) {
constructor(text) {
super({text: text, timestamp: Date.now()});
}
}
> new Event('started').toString()
Event { "text": "started", "timestamp": 1453376445769 }