Home Why method decorator call first when constructor is undefined?
Reply: 0

Why method decorator call first when constructor is undefined?

zh-mskl9
1#
zh-mskl9 Published in 2018-01-12 14:17:09Z

@Notify call first without constructor, but when constructor is defined, then @Observable calls first

class MyClass {
  @Observable() foo = "bar";
  
  // constructor() {}
   
  @Notify("foo")
  onFooChange(oldValue, newValue) {
    console.log(oldValue, newValue)
  }
}

new MyClass();

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.335042 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO