<commit_before>import { Component, ViewChild, Output, Input, EventEmitter } from '@angular/core';
import { ObserveViewChild }  from '@angularclass/observe-decorators';
import { Observable } from 'rxjs/Rx'

import { AppStore } from '../app-store';

//normal component with @Output event
@Component({
  template: `
  <div>
    <button (click)="increments.emit(1)">increment</button>
  </div>`
})
export class Incrementer {
  @Output() increments = new EventEmitter();
}


@Component({
  template: `
    <div>
      <h4>Child Total Count: {{ appStore.changes.pluck('counter') | async }}</h4>
      <incrementer></incrementer>
      <button #decrement>decrement</button>
    </div>
  `,
})
export class AngularclassApp {
  //query and listen to component output
  @ObserveViewChild(Incrementer) increments = new EventEmitter<number>();

  //query and listen to a DOM element
  @ObserveViewChild('decrement', 'click') decrements = new EventEmitter();


  // Notice how we're able to just return an Observable
  @Output() counterChange = Observable.merge(
    this.increments,
    this.decrements.mapTo(-1)
  )
  .startWith(0)
  .scan((total: number, value: number) => total + value, 0);

  constructor(public appStore: AppStore) {

  }

}

@Component({
  template: `
    <div>
      <h3>Parent Total Count: {{ counter }}</h3>
      <angularclass-app [yolo]="initialValue" [(counter)]="counter"></angularclass-app>
    </div>
  `
})
export class AcApp {
  initialValue = 90;
  @Input() counter  = 50;
  // we can abuse everything to get what we want
  @Output() @ObserveViewChild(AngularclassApp) counterChange = new EventEmitter();


}

@Component({
  template: `
    <div>
      <h2>Root Total Count: {{ counter }}</h2>
      <ac-app (counterChange)="$event"></ac-app>
    </div>
  `
})
export class ReactiveApp {
  get counter() {
    return this.appStore.getValue('counter');
  }

  @ObserveViewChild(AcApp) counterChange = new EventEmitter();<commit_msg>chore: remove event<commit_after>import { Component, ViewChild, Output, Input, EventEmitter } from '@angular/core';
import { ObserveViewChild }  from '@angularclass/observe-decorators';
import { Observable } from 'rxjs/Rx'

import { AppStore } from '../app-store';

//normal component with @Output event
@Component({
  template: `
  <div>
    <button (click)="increments.emit(1)">increment</button>
  </div>`
})
export class Incrementer {
  @Output() increments = new EventEmitter();
}


@Component({
  template: `
    <div>
      <h4>Child Total Count: {{ appStore.changes.pluck('counter') | async }}</h4>
      <incrementer></incrementer>
      <button #decrement>decrement</button>
    </div>
  `,
})
export class AngularclassApp {
  //query and listen to component output
  @ObserveViewChild(Incrementer) increments = new EventEmitter<number>();

  //query and listen to a DOM element
  @ObserveViewChild('decrement', 'click') decrements = new EventEmitter();


  // Notice how we're able to just return an Observable
  @Output() counterChange = Observable.merge(
    this.increments,
    this.decrements.mapTo(-1)
  )
  .startWith(0)
  .scan((total: number, value: number) => total + value, 0);

  constructor(public appStore: AppStore) {

  }

}

@Component({
  template: `
    <div>
      <h3>Parent Total Count: {{ counter }}</h3>
      <angularclass-app [yolo]="initialValue" [(counter)]="counter"></angularclass-app>
    </div>
  `
})
export class AcApp {
  initialValue = 90;
  @Input() counter  = 50;
  // we can abuse everything to get what we want
  @Output() @ObserveViewChild(AngularclassApp) counterChange = new EventEmitter();


}

@Component({
  template: `
    <div>
      <h2>Root Total Count: {{ counter }}</h2>
      <ac-app></ac-app>
    </div>
  `
})
export class ReactiveApp {
  get counter() {
    return this.appStore.getValue('counter');
  }

  @ObserveViewChild(AcApp) counterChange = new EventEmitter();
{'fraction_non_alphanumeric': 0.15255981476717262, 'fraction_numerical': 0.0072034988422948285, 'mean_word_length': 3.8, 'pattern_counts': {'":': 0, '<': 53, '<?xml version=': 0, '>': 55, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '748605', 'n_tokens_mistral': 1275, 'n_tokens_neox': 1236, 'n_words': 314}