@ray-core/runtime
Version:
Ray 是一个全新的基于 React 的小程序开发框架
96 lines (95 loc) • 3.04 kB
JavaScript
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
import setDataImmutable from './setDataImmutable';
import pages from './pages';
var Page = /** @class */ (function () {
function Page(config) {
this.config = __assign({ setData: this.setData.bind(this), data: {} }, config);
}
Page.prototype.setData = function (data) {
this.config.data = setDataImmutable(this.config.data, data);
};
Page.prototype.ready = function () {
this.config.onReady();
};
Page.prototype.load = function () {
this.config.onLoad({});
this.show();
};
Page.prototype.unload = function () {
this.config.onUnload();
};
Page.prototype.show = function () {
this.config.onShow();
};
Page.prototype.hide = function () {
this.config.onHide();
};
Page.prototype.pullDownRefresh = function () {
return this.config.onPullDownRefresh();
};
Page.prototype.reachBottom = function () {
this.config.onReachBottom();
};
Page.prototype.pageScroll = function () {
this.config.onPageScroll();
};
Page.prototype.shareAppMessage = function () {
this.config.onShareAppMessage({
from: 'menu',
target: undefined,
webViewUrl: 'https://www.alipay.com',
});
};
Page.prototype.shareTimeline = function () {
this.config.onShareTimeline({
from: 'menu',
target: undefined,
webViewUrl: 'https://www.alipay.com',
});
};
Page.prototype.titleClick = function () {
this.config.onTitleClick();
};
Page.prototype.optionMenuClick = function () {
this.config.onOptionMenuClick();
};
Page.prototype.popMenuClick = function () {
this.config.onPopMenuClick();
};
Page.prototype.pullIntercept = function () {
this.config.onPullIntercept();
};
Page.prototype.back = function () {
this.config.events.onBack.apply(this.config);
};
Page.prototype.keyboardHeight = function () {
this.config.events.onKeyboardHeight.apply(this.config);
};
Page.prototype.tabItemTap = function () {
this.config.events.onTabItemTap.apply(this.config);
this.config.onTabItemTap();
};
Page.prototype.beforeTabItemTap = function () {
this.config.events.beforeTabItemTap.apply(this.config);
};
Page.prototype.resize = function () {
this.config.events.onResize.apply(this.config);
this.config.onResize();
};
return Page;
}());
export default function PageConstructor(config) {
var page = new Page(config);
pages.push(page.config);
return page;
}