UNPKG

@ray-core/runtime

Version:

Ray 是一个全新的基于 React 的小程序开发框架

102 lines (101 loc) 3.34 kB
"use strict"; 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); }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); var setDataImmutable_1 = __importDefault(require("./setDataImmutable")); var pages_1 = __importDefault(require("./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 = (0, setDataImmutable_1.default)(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; }()); function PageConstructor(config) { var page = new Page(config); pages_1.default.push(page.config); return page; } exports.default = PageConstructor;