从Angular组件中移除Output属性值

我有一个思考性的实验,该实验源自有时需要为Angular组件的Output添加和删除函数的情况。 这是例子

Parent component will contain only output function for child component <my-component>.

ParentComponent

class ParentComponent{
  myOutputFunction = null;

  setOutputFunction() {
    this.myOutputFunction = () => {
      // do something
    };
  }

  removeOutputFunction() {
    this.myOutputFunction = null;
  }
}

ParentComponent的模板

<my-component (someOutput)="myOutputFunction($event)"><my-component>

Child component MyComponent will have output someOutput inside. This will serve also as a question how to detect when parent decided to do removeOutputFunction() and potentially subscribe to that event and react to it.

MyComponent子组件

class MyComponent {
  @Output() someOutput = new EventEmitter();

  ngOnInit(): void {
    // At this point we can see if there are any observers to someOutput
    if(this.someOutput.observers.length > 0) {
      console.log('YEY we have a set output method from ParentComponent to MyComponent`s attribute');
    } else {
      console.log('We have no attribute defined');
    }
  }
}

In ngOnInit() we can check if we have coded (someOutput)="myOutputFunction($event)".

So, the conclusion. Is there a way to listen (subscribe) to change of someOutput from parent from () => // do something value to null value.

When i log this.someOutput.observers i get array of Subscribers. Can I use this.someOutput as EventEmitter in some way to get to where this experiment is pointing to?

谢谢