Files
ionic-framework/ionic/components/scroll/pull-to-refresh.js
2015-05-11 22:33:32 -05:00

36 lines
778 B
JavaScript

import {NgElement, EventEmitter, PropertySetter} from 'angular2/angular2';
import {Component, Directive} from 'angular2/src/core/annotations_impl/annotations';
@Directive({
selector: '[ion-refresher]'
})
export class Refresher {
constructor(
@NgElement() element:NgElement
) {
this.domElement = element.domElement;
this.domElement.classList.add('content');
this.refreshEvent = new EventEmitter('refreshing');
console.log(this.domElement);
this.domElement.children[0].addEventListener('scroll', function(e) {
console.log('CONTENT: scroll', e.target.scrollTop);
});
setTimeout(() => {
this.refresh()
}, 1000);
}
refresh() {
console.log('REFRESH');
this.refreshEvent.next({
data: 'blah'
});
}
}