microsoft / TypeScriptSamples

Community Driven Samples for TypeScript
3.18k stars 1.79k forks source link

How is "initialize" used? #94

Open Sequoia opened 8 years ago

Sequoia commented 8 years ago

https://github.com/Microsoft/TypeScriptSamples/blob/master/todomvc/js/todos.ts#L131-L135

        // Ensure that each todo created has `content`.
    initialize() {
        if (!this.get("content")) {
            this.set({ "content": this.defaults().content });
        }
    }

How/where is this called? My preference for a todo example is for stuff like this to be explicit or commented-- I am looking at this repo precisely because I'm not familiar with typescript, so I'm not sure if it's a typescript thing, a backbone thing (if so why isn't it in the Backbone.Model ts def?). Thanks!

Sequoia commented 8 years ago

I see it's a backbone thing but why isn't it in the Backbone.Model def?