I have two coffeescript classes something like this. In the base view model I have a method that I want to override in the child that inherits from the base view model.

class exports.BaseViewModel
    constructor: () ->

    someBaseMethod: =>
        console.log "I'm doing the base stuff"

class ChildViewModel extends BaseViewModel
    constructor: () ->

    someBaseMethod: =>
        @doSomethingFirst()
        super @someBaseMethod()

This isn't working as is because the line super @someBaseMethod() calls itself creating an infinite loop.

Is it possible to achieve what I want here?

Edit
Report