yoho-page.js
486 Bytes
import app from './yoho-app';
import $ from 'yoho-jquery';
import qs from 'yoho-qs';
class Page {
constructor() {
this.app = app;
this.qs = qs;
this.$event = $(document);
}
on(name, ...cb) {
name = `yohoevent.${name}`;
this.event.on(name, ...cb);
}
emit(name, ...data) {
this.$event.trigger(name, ...data);
}
ajax(options = {}) {
return Promise.resolve($.ajax(options));
}
}
export default Page;