@goji/core
Advanced tools
Comparing version 0.4.19 to 0.5.0
@@ -1,1 +0,2 @@ | ||
{} | ||
{"/Users/chong_ma/Projects/goji/packages/core/src/adaptor/wechat.tsx": {"path":"/Users/chong_ma/Projects/goji/packages/core/src/adaptor/wechat.tsx","statementMap":{"0":{"start":{"line":43,"column":66},"end":{"line":53,"column":1}},"1":{"start":{"line":45,"column":4},"end":{"line":45,"column":37}},"2":{"start":{"line":48,"column":4},"end":{"line":48,"column":35}},"3":{"start":{"line":51,"column":4},"end":{"line":51,"column":32}},"4":{"start":{"line":55,"column":31},"end":{"line":79,"column":1}},"5":{"start":{"line":64,"column":28},"end":{"line":64,"column":48}},"6":{"start":{"line":65,"column":2},"end":{"line":70,"column":5}},"7":{"start":{"line":66,"column":4},"end":{"line":69,"column":7}},"8":{"start":{"line":71,"column":21},"end":{"line":76,"column":3}},"9":{"start":{"line":72,"column":30},"end":{"line":72,"column":54}},"10":{"start":{"line":73,"column":30},"end":{"line":75,"column":5}},"11":{"start":{"line":74,"column":6},"end":{"line":74,"column":41}},"12":{"start":{"line":78,"column":2},"end":{"line":78,"column":61}},"13":{"start":{"line":83,"column":4},"end":{"line":83,"column":12}},"14":{"start":{"line":84,"column":4},"end":{"line":84,"column":21}},"15":{"start":{"line":85,"column":4},"end":{"line":85,"column":33}},"16":{"start":{"line":93,"column":27},"end":{"line":155,"column":5}},"17":{"start":{"line":95,"column":26},"end":{"line":97,"column":9}},"18":{"start":{"line":98,"column":8},"end":{"line":98,"column":42}},"19":{"start":{"line":100,"column":8},"end":{"line":102,"column":10}},"20":{"start":{"line":104,"column":8},"end":{"line":104,"column":69}},"21":{"start":{"line":108,"column":8},"end":{"line":108,"column":62}},"22":{"start":{"line":110,"column":8},"end":{"line":112,"column":9}},"23":{"start":{"line":111,"column":10},"end":{"line":111,"column":45}},"24":{"start":{"line":113,"column":8},"end":{"line":113,"column":42}},"25":{"start":{"line":117,"column":8},"end":{"line":117,"column":60}},"26":{"start":{"line":121,"column":8},"end":{"line":121,"column":60}},"27":{"start":{"line":125,"column":8},"end":{"line":125,"column":71}},"28":{"start":{"line":129,"column":8},"end":{"line":129,"column":67}},"29":{"start":{"line":133,"column":8},"end":{"line":133,"column":66}},"30":{"start":{"line":137,"column":8},"end":{"line":137,"column":80}},"31":{"start":{"line":141,"column":8},"end":{"line":141,"column":66}},"32":{"start":{"line":145,"column":8},"end":{"line":145,"column":71}},"33":{"start":{"line":149,"column":8},"end":{"line":149,"column":68}},"34":{"start":{"line":153,"column":8},"end":{"line":153,"column":69}},"35":{"start":{"line":157,"column":25},"end":{"line":161,"column":5}},"36":{"start":{"line":159,"column":8},"end":{"line":159,"column":32}},"37":{"start":{"line":163,"column":21},"end":{"line":163,"column":25}},"38":{"start":{"line":164,"column":4},"end":{"line":220,"column":5}},"39":{"start":{"line":165,"column":43},"end":{"line":165,"column":57}},"40":{"start":{"line":167,"column":6},"end":{"line":170,"column":9}},"41":{"start":{"line":171,"column":11},"end":{"line":220,"column":5}},"42":{"start":{"line":172,"column":53},"end":{"line":174,"column":7}},"43":{"start":{"line":175,"column":6},"end":{"line":175,"column":33}},"44":{"start":{"line":176,"column":11},"end":{"line":220,"column":5}},"45":{"start":{"line":177,"column":42},"end":{"line":177,"column":57}},"46":{"start":{"line":178,"column":48},"end":{"line":218,"column":7}},"47":{"start":{"line":181,"column":29},"end":{"line":192,"column":11}},"48":{"start":{"line":185,"column":14},"end":{"line":187,"column":15}},"49":{"start":{"line":186,"column":16},"end":{"line":186,"column":23}},"50":{"start":{"line":188,"column":14},"end":{"line":190,"column":17}},"51":{"start":{"line":196,"column":30},"end":{"line":198,"column":13}},"52":{"start":{"line":199,"column":12},"end":{"line":199,"column":46}},"53":{"start":{"line":201,"column":12},"end":{"line":207,"column":14}},"54":{"start":{"line":209,"column":12},"end":{"line":209,"column":97}},"55":{"start":{"line":212,"column":12},"end":{"line":214,"column":13}},"56":{"start":{"line":213,"column":14},"end":{"line":213,"column":49}},"57":{"start":{"line":215,"column":12},"end":{"line":215,"column":46}},"58":{"start":{"line":219,"column":6},"end":{"line":219,"column":28}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":44,"column":2},"end":{"line":44,"column":3}},"loc":{"start":{"line":44,"column":72},"end":{"line":46,"column":3}},"line":44},"1":{"name":"(anonymous_1)","decl":{"start":{"line":47,"column":2},"end":{"line":47,"column":3}},"loc":{"start":{"line":47,"column":89},"end":{"line":49,"column":3}},"line":47},"2":{"name":"(anonymous_2)","decl":{"start":{"line":50,"column":2},"end":{"line":50,"column":3}},"loc":{"start":{"line":50,"column":71},"end":{"line":52,"column":3}},"line":50},"3":{"name":"(anonymous_3)","decl":{"start":{"line":55,"column":31},"end":{"line":55,"column":32}},"loc":{"start":{"line":63,"column":6},"end":{"line":79,"column":1}},"line":63},"4":{"name":"(anonymous_4)","decl":{"start":{"line":65,"column":29},"end":{"line":65,"column":30}},"loc":{"start":{"line":65,"column":41},"end":{"line":70,"column":3}},"line":65},"5":{"name":"(anonymous_5)","decl":{"start":{"line":72,"column":21},"end":{"line":72,"column":22}},"loc":{"start":{"line":72,"column":30},"end":{"line":72,"column":54}},"line":72},"6":{"name":"(anonymous_6)","decl":{"start":{"line":73,"column":21},"end":{"line":73,"column":22}},"loc":{"start":{"line":73,"column":30},"end":{"line":75,"column":5}},"line":73},"7":{"name":"(anonymous_7)","decl":{"start":{"line":73,"column":30},"end":{"line":73,"column":31}},"loc":{"start":{"line":73,"column":45},"end":{"line":75,"column":5}},"line":73},"8":{"name":"(anonymous_8)","decl":{"start":{"line":82,"column":2},"end":{"line":82,"column":3}},"loc":{"start":{"line":82,"column":71},"end":{"line":86,"column":3}},"line":82},"9":{"name":"(anonymous_9)","decl":{"start":{"line":92,"column":2},"end":{"line":92,"column":3}},"loc":{"start":{"line":92,"column":74},"end":{"line":221,"column":3}},"line":92},"10":{"name":"(anonymous_10)","decl":{"start":{"line":94,"column":6},"end":{"line":94,"column":7}},"loc":{"start":{"line":94,"column":49},"end":{"line":105,"column":7}},"line":94},"11":{"name":"(anonymous_11)","decl":{"start":{"line":107,"column":6},"end":{"line":107,"column":7}},"loc":{"start":{"line":107,"column":37},"end":{"line":114,"column":7}},"line":107},"12":{"name":"(anonymous_12)","decl":{"start":{"line":116,"column":6},"end":{"line":116,"column":7}},"loc":{"start":{"line":116,"column":35},"end":{"line":118,"column":7}},"line":116},"13":{"name":"(anonymous_13)","decl":{"start":{"line":120,"column":6},"end":{"line":120,"column":7}},"loc":{"start":{"line":120,"column":35},"end":{"line":122,"column":7}},"line":120},"14":{"name":"(anonymous_14)","decl":{"start":{"line":124,"column":6},"end":{"line":124,"column":7}},"loc":{"start":{"line":124,"column":46},"end":{"line":126,"column":7}},"line":124},"15":{"name":"(anonymous_15)","decl":{"start":{"line":128,"column":6},"end":{"line":128,"column":7}},"loc":{"start":{"line":128,"column":42},"end":{"line":130,"column":7}},"line":128},"16":{"name":"(anonymous_16)","decl":{"start":{"line":132,"column":6},"end":{"line":132,"column":7}},"loc":{"start":{"line":132,"column":41},"end":{"line":134,"column":7}},"line":132},"17":{"name":"(anonymous_17)","decl":{"start":{"line":136,"column":6},"end":{"line":136,"column":7}},"loc":{"start":{"line":136,"column":55},"end":{"line":138,"column":7}},"line":136},"18":{"name":"(anonymous_18)","decl":{"start":{"line":140,"column":6},"end":{"line":140,"column":7}},"loc":{"start":{"line":140,"column":41},"end":{"line":142,"column":7}},"line":140},"19":{"name":"(anonymous_19)","decl":{"start":{"line":144,"column":6},"end":{"line":144,"column":7}},"loc":{"start":{"line":144,"column":46},"end":{"line":146,"column":7}},"line":144},"20":{"name":"(anonymous_20)","decl":{"start":{"line":148,"column":6},"end":{"line":148,"column":7}},"loc":{"start":{"line":148,"column":43},"end":{"line":150,"column":7}},"line":148},"21":{"name":"(anonymous_21)","decl":{"start":{"line":152,"column":6},"end":{"line":152,"column":7}},"loc":{"start":{"line":152,"column":44},"end":{"line":154,"column":7}},"line":152},"22":{"name":"(anonymous_22)","decl":{"start":{"line":158,"column":6},"end":{"line":158,"column":7}},"loc":{"start":{"line":158,"column":13},"end":{"line":160,"column":7}},"line":158},"23":{"name":"(anonymous_23)","decl":{"start":{"line":181,"column":20},"end":{"line":181,"column":21}},"loc":{"start":{"line":181,"column":29},"end":{"line":192,"column":11}},"line":181},"24":{"name":"(anonymous_24)","decl":{"start":{"line":184,"column":12},"end":{"line":184,"column":13}},"loc":{"start":{"line":184,"column":56},"end":{"line":191,"column":13}},"line":184},"25":{"name":"(anonymous_25)","decl":{"start":{"line":195,"column":10},"end":{"line":195,"column":11}},"loc":{"start":{"line":195,"column":41},"end":{"line":210,"column":11}},"line":195},"26":{"name":"(anonymous_26)","decl":{"start":{"line":211,"column":10},"end":{"line":211,"column":11}},"loc":{"start":{"line":211,"column":41},"end":{"line":216,"column":11}},"line":211}},"branchMap":{"0":{"loc":{"start":{"line":82,"column":33},"end":{"line":82,"column":69}},"type":"default-arg","locations":[{"start":{"line":82,"column":67},"end":{"line":82,"column":69}}],"line":82},"1":{"loc":{"start":{"line":110,"column":8},"end":{"line":112,"column":9}},"type":"if","locations":[{"start":{"line":110,"column":8},"end":{"line":112,"column":9}},{"start":{"line":110,"column":8},"end":{"line":112,"column":9}}],"line":110},"2":{"loc":{"start":{"line":164,"column":4},"end":{"line":220,"column":5}},"type":"if","locations":[{"start":{"line":164,"column":4},"end":{"line":220,"column":5}},{"start":{"line":164,"column":4},"end":{"line":220,"column":5}}],"line":164},"3":{"loc":{"start":{"line":171,"column":11},"end":{"line":220,"column":5}},"type":"if","locations":[{"start":{"line":171,"column":11},"end":{"line":220,"column":5}},{"start":{"line":171,"column":11},"end":{"line":220,"column":5}}],"line":171},"4":{"loc":{"start":{"line":176,"column":11},"end":{"line":220,"column":5}},"type":"if","locations":[{"start":{"line":176,"column":11},"end":{"line":220,"column":5}},{"start":{"line":176,"column":11},"end":{"line":220,"column":5}}],"line":176},"5":{"loc":{"start":{"line":177,"column":14},"end":{"line":177,"column":25}},"type":"default-arg","locations":[{"start":{"line":177,"column":23},"end":{"line":177,"column":25}}],"line":177},"6":{"loc":{"start":{"line":177,"column":27},"end":{"line":177,"column":37}},"type":"default-arg","locations":[{"start":{"line":177,"column":35},"end":{"line":177,"column":37}}],"line":177},"7":{"loc":{"start":{"line":185,"column":14},"end":{"line":187,"column":15}},"type":"if","locations":[{"start":{"line":185,"column":14},"end":{"line":187,"column":15}},{"start":{"line":185,"column":14},"end":{"line":187,"column":15}}],"line":185},"8":{"loc":{"start":{"line":212,"column":12},"end":{"line":214,"column":13}},"type":"if","locations":[{"start":{"line":212,"column":12},"end":{"line":214,"column":13}},{"start":{"line":212,"column":12},"end":{"line":214,"column":13}}],"line":212}},"s":{"0":5,"1":6,"2":0,"3":0,"4":5,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":3,"14":3,"15":3,"16":4,"17":4,"18":4,"19":4,"20":4,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":4,"36":0,"37":4,"38":4,"39":4,"40":4,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0},"f":{"0":6,"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":3,"9":4,"10":4,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0},"b":{"0":[2],"1":[0,0],"2":[4,0],"3":[0,0],"4":[0,0],"5":[0],"6":[0],"7":[0,0],"8":[0,0]},"_coverageSchema":"43e27e138ebf9cfc5966b082cf9a028302ed4184","hash":"1d89ed4c768fcb97534f20bf1860604c83d8742d"} | ||
} |
@@ -18,5 +18,5 @@ "use strict"; | ||
const common_1 = require("./common"); | ||
const lifecycles_1 = require("../lifecycles"); | ||
const events_1 = require("../events"); | ||
const portal_1 = require("../portal"); | ||
const hooks_1 = require("../lifecycles/native/hooks"); | ||
exports.wechatAdaptorConfig = { | ||
@@ -35,3 +35,3 @@ updateData(instance, data, callback) { | ||
const [props, setProps] = react_1.useState({}); | ||
lifecycles_1.useInternalComponentUpdate(newProps => { | ||
hooks_1.useInternalComponentUpdate(newProps => { | ||
setProps({ | ||
@@ -58,8 +58,7 @@ ...props, | ||
this.__GOJI_CONTAINER = container; | ||
container.render(react_1.default.createElement(lifecycles_1.LifecycleWrapper, null, | ||
react_1.default.createElement(portal_1.PortalWrapper, { createPortal: container.createPortal }, element))); | ||
this.__GOJI_CONTAINER.emitLifecycle('onLoad', options); | ||
container.render(react_1.default.createElement(portal_1.PortalWrapper, { createPortal: container.createPortal }, element)); | ||
this.__GOJI_CONTAINER.emitLifecycleEvent('onLoad', options); | ||
}, | ||
onUnload() { | ||
this.__GOJI_CONTAINER.emitLifecycle('onUnload'); | ||
this.__GOJI_CONTAINER.emitLifecycleEvent('onUnload'); | ||
if (this.__GOJI_CONTAINER) { | ||
@@ -71,30 +70,30 @@ this.__GOJI_CONTAINER.render(null); | ||
onShow() { | ||
this.__GOJI_CONTAINER.emitLifecycle('onShow'); | ||
this.__GOJI_CONTAINER.emitLifecycleEvent('onShow'); | ||
}, | ||
onHide() { | ||
this.__GOJI_CONTAINER.emitLifecycle('onHide'); | ||
this.__GOJI_CONTAINER.emitLifecycleEvent('onHide'); | ||
}, | ||
onPullDownRefresh() { | ||
this.__GOJI_CONTAINER.emitLifecycle('onPullDownRefresh'); | ||
this.__GOJI_CONTAINER.emitLifecycleEvent('onPullDownRefresh'); | ||
}, | ||
onReachBottom() { | ||
this.__GOJI_CONTAINER.emitLifecycle('onReachBottom'); | ||
this.__GOJI_CONTAINER.emitLifecycleEvent('onReachBottom'); | ||
}, | ||
onPageScroll() { | ||
this.__GOJI_CONTAINER.emitLifecycle('onPageScroll'); | ||
this.__GOJI_CONTAINER.emitLifecycleEvent('onPageScroll'); | ||
}, | ||
onShareAppMessage(options) { | ||
this.__GOJI_CONTAINER.emitLifecycle('onShareAppMessage', options); | ||
this.__GOJI_CONTAINER.emitLifecycleEvent('onShareAppMessage', options); | ||
}, | ||
onTitleClick() { | ||
this.__GOJI_CONTAINER.emitLifecycle('onTitleClick'); | ||
this.__GOJI_CONTAINER.emitLifecycleEvent('onTitleClick'); | ||
}, | ||
onOptionMenuClick() { | ||
this.__GOJI_CONTAINER.emitLifecycle('onOptionMenuClick'); | ||
this.__GOJI_CONTAINER.emitLifecycleEvent('onOptionMenuClick'); | ||
}, | ||
onPopMenuClick() { | ||
this.__GOJI_CONTAINER.emitLifecycle('onPopMenuClick'); | ||
this.__GOJI_CONTAINER.emitLifecycleEvent('onPopMenuClick'); | ||
}, | ||
onPullIntercept() { | ||
this.__GOJI_CONTAINER.emitLifecycle('onPullIntercept'); | ||
this.__GOJI_CONTAINER.emitLifecycleEvent('onPullIntercept'); | ||
}, | ||
@@ -133,3 +132,5 @@ }; | ||
} | ||
this.__GOJI_CONTAINER.emitLifecycle('internalComponentUpdate', { [prop]: newVal }); | ||
this.__GOJI_CONTAINER.emitLifecycleEvent('internalComponentUpdate', { | ||
[prop]: newVal, | ||
}); | ||
}, | ||
@@ -141,6 +142,5 @@ }))), | ||
this.__GOJI_CONTAINER = container; | ||
container.render(react_1.default.createElement(lifecycles_1.LifecycleWrapper, null, | ||
react_1.default.createElement(portal_1.PortalWrapper, { createPortal: container.createPortal }, | ||
react_1.default.createElement(ExportComponentWrapper, { instance: this, exportEvents: events }, element)))); | ||
this.__GOJI_CONTAINER.emitLifecycle('internalComponentUpdate', this.properties); | ||
container.render(react_1.default.createElement(portal_1.PortalWrapper, { createPortal: container.createPortal }, | ||
react_1.default.createElement(ExportComponentWrapper, { instance: this, exportEvents: events }, element))); | ||
this.__GOJI_CONTAINER.emitLifecycleEvent('internalComponentUpdate', this.properties); | ||
}, | ||
@@ -147,0 +147,0 @@ detached() { |
/// <reference types="react" /> | ||
import { FiberRoot } from 'react-reconciler'; | ||
import { LifecycleName } from './lifecycles'; | ||
import { AdaptorInstance } from './adaptor'; | ||
import { ElementInstance, TextInstance } from './instance'; | ||
import { LifecycleName } from './lifecycles/types'; | ||
export declare abstract class BasedContainer { | ||
@@ -11,3 +11,3 @@ protected adpatorInstance: AdaptorInstance<any>; | ||
abstract render(element: JSX.Element | null): void; | ||
abstract emitLifecycle(eventName: LifecycleName, eventData?: any): any; | ||
abstract emitLifecycleEvent(eventName: LifecycleName, eventData?: any): any; | ||
} | ||
@@ -27,3 +27,3 @@ export declare class Container extends BasedContainer { | ||
private getRootDom; | ||
emitLifecycle(eventName: LifecycleName, eventData?: any): void; | ||
emitLifecycleEvent(eventName: LifecycleName, eventData?: any): void; | ||
render(element: JSX.Element | null): void; | ||
@@ -30,0 +30,0 @@ createPortal: (element: JSX.Element | null) => { |
@@ -8,2 +8,3 @@ "use strict"; | ||
const events_1 = require("./events"); | ||
const components_1 = require("./components"); | ||
const getGlobalVariable = () => { | ||
@@ -112,10 +113,10 @@ /* eslint-disable no-undef */ | ||
} | ||
emitLifecycle(eventName, eventData) { | ||
emitLifecycleEvent(eventName, eventData) { | ||
const publicRootInstance = this.getPublicRootInstance(); | ||
if (publicRootInstance) { | ||
publicRootInstance.emitLifecycle(eventName, eventData); | ||
publicRootInstance.emitEvent(eventName, eventData); | ||
} | ||
} | ||
render(element) { | ||
render_1.internalRender(element, this); | ||
render_1.internalRender(components_1.createRootElement(element), this); | ||
} | ||
@@ -122,0 +123,0 @@ } |
@@ -1,4 +0,2 @@ | ||
export * from './hooks'; | ||
export { LifecycleWrapper } from './wrapper'; | ||
export { LifecyclesContext } from './context'; | ||
export { LifecycleName } from './types'; | ||
export * from './native'; | ||
export * from './universal'; |
@@ -6,7 +6,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./hooks")); | ||
var wrapper_1 = require("./wrapper"); | ||
exports.LifecycleWrapper = wrapper_1.LifecycleWrapper; | ||
var context_1 = require("./context"); | ||
exports.LifecyclesContext = context_1.LifecyclesContext; | ||
__export(require("./native")); | ||
__export(require("./universal")); | ||
//# sourceMappingURL=index.js.map |
@@ -5,2 +5,3 @@ declare type WechatLifecycleName = 'onLoad' | 'onShow' | 'onReady' | 'onHide' | 'onUnload' | 'onUnload' | 'onPullDownRefresh' | 'onReachBottom' | 'onPageScroll' | 'onShareAppMessage' | 'onResize' | 'onTabItemTap'; | ||
export declare type LifecycleName = WechatLifecycleName | AlipayLifecycleName | InternalLifecycleName; | ||
export declare type UniversalLifecycleName = 'loadOptions' | 'visibility'; | ||
export interface OnLoadOptions { | ||
@@ -7,0 +8,0 @@ [key: string]: string; |
@@ -6,5 +6,5 @@ import React, { cloneElement, useState } from 'react'; | ||
import { Adaptor } from './common'; | ||
import { LifecycleWrapper, useInternalComponentUpdate } from '../lifecycles'; | ||
import { gojiEvents } from '../events'; | ||
import { PortalWrapper } from '../portal'; | ||
import { useInternalComponentUpdate } from '../lifecycles/native/hooks'; | ||
export const wechatAdaptorConfig = { | ||
@@ -45,8 +45,7 @@ updateData(instance, data, callback) { | ||
this.__GOJI_CONTAINER = container; | ||
container.render(React.createElement(LifecycleWrapper, null, | ||
React.createElement(PortalWrapper, { createPortal: container.createPortal }, element))); | ||
this.__GOJI_CONTAINER.emitLifecycle('onLoad', options); | ||
container.render(React.createElement(PortalWrapper, { createPortal: container.createPortal }, element)); | ||
this.__GOJI_CONTAINER.emitLifecycleEvent('onLoad', options); | ||
}, | ||
onUnload() { | ||
this.__GOJI_CONTAINER.emitLifecycle('onUnload'); | ||
this.__GOJI_CONTAINER.emitLifecycleEvent('onUnload'); | ||
if (this.__GOJI_CONTAINER) { | ||
@@ -58,30 +57,30 @@ this.__GOJI_CONTAINER.render(null); | ||
onShow() { | ||
this.__GOJI_CONTAINER.emitLifecycle('onShow'); | ||
this.__GOJI_CONTAINER.emitLifecycleEvent('onShow'); | ||
}, | ||
onHide() { | ||
this.__GOJI_CONTAINER.emitLifecycle('onHide'); | ||
this.__GOJI_CONTAINER.emitLifecycleEvent('onHide'); | ||
}, | ||
onPullDownRefresh() { | ||
this.__GOJI_CONTAINER.emitLifecycle('onPullDownRefresh'); | ||
this.__GOJI_CONTAINER.emitLifecycleEvent('onPullDownRefresh'); | ||
}, | ||
onReachBottom() { | ||
this.__GOJI_CONTAINER.emitLifecycle('onReachBottom'); | ||
this.__GOJI_CONTAINER.emitLifecycleEvent('onReachBottom'); | ||
}, | ||
onPageScroll() { | ||
this.__GOJI_CONTAINER.emitLifecycle('onPageScroll'); | ||
this.__GOJI_CONTAINER.emitLifecycleEvent('onPageScroll'); | ||
}, | ||
onShareAppMessage(options) { | ||
this.__GOJI_CONTAINER.emitLifecycle('onShareAppMessage', options); | ||
this.__GOJI_CONTAINER.emitLifecycleEvent('onShareAppMessage', options); | ||
}, | ||
onTitleClick() { | ||
this.__GOJI_CONTAINER.emitLifecycle('onTitleClick'); | ||
this.__GOJI_CONTAINER.emitLifecycleEvent('onTitleClick'); | ||
}, | ||
onOptionMenuClick() { | ||
this.__GOJI_CONTAINER.emitLifecycle('onOptionMenuClick'); | ||
this.__GOJI_CONTAINER.emitLifecycleEvent('onOptionMenuClick'); | ||
}, | ||
onPopMenuClick() { | ||
this.__GOJI_CONTAINER.emitLifecycle('onPopMenuClick'); | ||
this.__GOJI_CONTAINER.emitLifecycleEvent('onPopMenuClick'); | ||
}, | ||
onPullIntercept() { | ||
this.__GOJI_CONTAINER.emitLifecycle('onPullIntercept'); | ||
this.__GOJI_CONTAINER.emitLifecycleEvent('onPullIntercept'); | ||
}, | ||
@@ -120,3 +119,5 @@ }; | ||
} | ||
this.__GOJI_CONTAINER.emitLifecycle('internalComponentUpdate', { [prop]: newVal }); | ||
this.__GOJI_CONTAINER.emitLifecycleEvent('internalComponentUpdate', { | ||
[prop]: newVal, | ||
}); | ||
}, | ||
@@ -128,6 +129,5 @@ }))), | ||
this.__GOJI_CONTAINER = container; | ||
container.render(React.createElement(LifecycleWrapper, null, | ||
React.createElement(PortalWrapper, { createPortal: container.createPortal }, | ||
React.createElement(ExportComponentWrapper, { instance: this, exportEvents: events }, element)))); | ||
this.__GOJI_CONTAINER.emitLifecycle('internalComponentUpdate', this.properties); | ||
container.render(React.createElement(PortalWrapper, { createPortal: container.createPortal }, | ||
React.createElement(ExportComponentWrapper, { instance: this, exportEvents: events }, element))); | ||
this.__GOJI_CONTAINER.emitLifecycleEvent('internalComponentUpdate', this.properties); | ||
}, | ||
@@ -134,0 +134,0 @@ detached() { |
/// <reference types="react" /> | ||
import { FiberRoot } from 'react-reconciler'; | ||
import { LifecycleName } from './lifecycles'; | ||
import { AdaptorInstance } from './adaptor'; | ||
import { ElementInstance, TextInstance } from './instance'; | ||
import { LifecycleName } from './lifecycles/types'; | ||
export declare abstract class BasedContainer { | ||
@@ -11,3 +11,3 @@ protected adpatorInstance: AdaptorInstance<any>; | ||
abstract render(element: JSX.Element | null): void; | ||
abstract emitLifecycle(eventName: LifecycleName, eventData?: any): any; | ||
abstract emitLifecycleEvent(eventName: LifecycleName, eventData?: any): any; | ||
} | ||
@@ -27,3 +27,3 @@ export declare class Container extends BasedContainer { | ||
private getRootDom; | ||
emitLifecycle(eventName: LifecycleName, eventData?: any): void; | ||
emitLifecycleEvent(eventName: LifecycleName, eventData?: any): void; | ||
render(element: JSX.Element | null): void; | ||
@@ -30,0 +30,0 @@ createPortal: (element: JSX.Element | null) => { |
@@ -6,2 +6,3 @@ import { cloneElement } from 'react'; | ||
import { gojiEvents } from './events'; | ||
import { createRootElement } from './components'; | ||
const getGlobalVariable = () => { | ||
@@ -109,12 +110,12 @@ /* eslint-disable no-undef */ | ||
} | ||
emitLifecycle(eventName, eventData) { | ||
emitLifecycleEvent(eventName, eventData) { | ||
const publicRootInstance = this.getPublicRootInstance(); | ||
if (publicRootInstance) { | ||
publicRootInstance.emitLifecycle(eventName, eventData); | ||
publicRootInstance.emitEvent(eventName, eventData); | ||
} | ||
} | ||
render(element) { | ||
internalRender(element, this); | ||
internalRender(createRootElement(element), this); | ||
} | ||
} | ||
//# sourceMappingURL=container.js.map |
@@ -1,4 +0,2 @@ | ||
export * from './hooks'; | ||
export { LifecycleWrapper } from './wrapper'; | ||
export { LifecyclesContext } from './context'; | ||
export { LifecycleName } from './types'; | ||
export * from './native'; | ||
export * from './universal'; |
@@ -1,4 +0,3 @@ | ||
export * from './hooks'; | ||
export { LifecycleWrapper } from './wrapper'; | ||
export { LifecyclesContext } from './context'; | ||
export * from './native'; | ||
export * from './universal'; | ||
//# sourceMappingURL=index.js.map |
@@ -5,2 +5,3 @@ declare type WechatLifecycleName = 'onLoad' | 'onShow' | 'onReady' | 'onHide' | 'onUnload' | 'onUnload' | 'onPullDownRefresh' | 'onReachBottom' | 'onPageScroll' | 'onShareAppMessage' | 'onResize' | 'onTabItemTap'; | ||
export declare type LifecycleName = WechatLifecycleName | AlipayLifecycleName | InternalLifecycleName; | ||
export declare type UniversalLifecycleName = 'loadOptions' | 'visibility'; | ||
export interface OnLoadOptions { | ||
@@ -7,0 +8,0 @@ [key: string]: string; |
{ | ||
"name": "@goji/core", | ||
"version": "0.4.19", | ||
"version": "0.5.0", | ||
"description": "Goji Core", | ||
@@ -80,3 +80,3 @@ "main": "dist/cjs/index.js", | ||
}, | ||
"gitHead": "a430aeca29f20ae3688f114d626d08c24356a81d" | ||
"gitHead": "c22bd62ca953444d8dc506885292fa786c3e6ac8" | ||
} |
import { cloneElement } from 'react'; | ||
import { FiberRoot } from 'react-reconciler'; | ||
import { Portal } from 'react-is'; | ||
import { LifecycleWrapper, LifecycleName } from './lifecycles'; | ||
import { AdaptorInstance } from './adaptor'; | ||
@@ -9,2 +8,5 @@ import { internalRender } from './render'; | ||
import { gojiEvents } from './events'; | ||
import { EventProxyProvider } from './components/eventProxy'; | ||
import { createRootElement } from './components'; | ||
import { LifecycleName } from './lifecycles/types'; | ||
@@ -44,3 +46,3 @@ const getGlobalVariable = () => { | ||
public abstract emitLifecycle(eventName: LifecycleName, eventData?: any); | ||
public abstract emitLifecycleEvent(eventName: LifecycleName, eventData?: any); | ||
} | ||
@@ -137,6 +139,6 @@ | ||
public emitLifecycle(eventName: LifecycleName, eventData?: any) { | ||
public emitLifecycleEvent(eventName: LifecycleName, eventData?: any) { | ||
const publicRootInstance = this.getPublicRootInstance(); | ||
if (publicRootInstance) { | ||
(publicRootInstance as LifecycleWrapper).emitLifecycle(eventName, eventData); | ||
(publicRootInstance as EventProxyProvider).emitEvent(eventName, eventData); | ||
} | ||
@@ -146,3 +148,3 @@ } | ||
public render(element: JSX.Element | null) { | ||
internalRender(element, this); | ||
internalRender(createRootElement(element), this); | ||
} | ||
@@ -149,0 +151,0 @@ |
@@ -1,4 +0,2 @@ | ||
export * from './hooks'; | ||
export { LifecycleWrapper } from './wrapper'; | ||
export { LifecyclesContext } from './context'; | ||
export { LifecycleName } from './types'; | ||
export * from './native'; | ||
export * from './universal'; |
@@ -26,2 +26,4 @@ type WechatLifecycleName = | ||
export type UniversalLifecycleName = 'loadOptions' | 'visibility'; | ||
export interface OnLoadOptions { | ||
@@ -28,0 +30,0 @@ [key: string]: string; |
@@ -11,3 +11,3 @@ import { ElementInstance } from '../src/instance'; | ||
public emitLifecycle() { | ||
public emitLifecycleEvent() { | ||
// do nothing | ||
@@ -14,0 +14,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
513833
256
5557