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