turn class into observer

This commit is contained in:
Shelley Vohr 2018-01-27 10:40:50 -05:00
parent 3399480304
commit bef4c84799
No known key found for this signature in database
GPG key ID: F13993A75599653C
2 changed files with 6 additions and 1 deletions

View file

@ -23,9 +23,13 @@ Menu::Menu(v8::Isolate* isolate, v8::Local<v8::Object> wrapper)
: model_(new AtomMenuModel(this)),
parent_(nullptr) {
InitWith(isolate, wrapper);
model_->AddObserver(this);
}
Menu::~Menu() {
if (model_) {
model_->RemoveObserver(this);
}
}
void Menu::AfterInit(v8::Isolate* isolate) {