Socket
Socket
Sign inDemoInstall

wechat-mini-program-extend

Package Overview
Dependencies
0
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.7 to 1.0.8

2

dist/core/LifeCycleInstaller.js

@@ -1,1 +0,1 @@

"use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _OptionInstaller2=_interopRequireDefault(require("./OptionInstaller")),_common=require("../utils/common"),_Deconstruct=require("../libs/Deconstruct"),_Invocation=require("../libs/Invocation");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),e}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_setPrototypeOf(e,t)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _createSuper(n){var o=_isNativeReflectConstruct();return function(){var e,t=_getPrototypeOf(n);return _possibleConstructorReturn(this,o?(e=_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function _possibleConstructorReturn(e,t){if(t&&("object"===_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(e)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var LifeCycleInstaller=function(){_inherits(t,_OptionInstaller2["default"]);var e=_createSuper(t);function t(){return _classCallCheck(this,t),e.apply(this,arguments)}return _createClass(t,[{key:"behaviorLifeCycleDefinition",value:function(e,t,n,o){var r=arguments,i=this,c=(0,_Deconstruct.Deconstruct)({},{ready:function(){return function(){t.get("ready").apply(this,arguments)}},lifetimes:function(){return{created:function(){t.get("lifetimes").created.apply(this,arguments)},moved:function(){t.get("lifetimes").moved.apply(i,r)},attached:function(){t.get("lifetimes").attached.apply(this,arguments)},detached:function(){t.get("lifetimes").detached.apply(this,arguments)}}},pageLifetimes:function(){return{show:function(){t.get("pageLifetimes").show.apply(this,arguments)},hide:function(){t.get("pageLifetimes").hide.apply(this,arguments)},resize:function(){t.get("pageLifetimes").resize.apply(this,arguments)}}}});o.behaviors=(o.behaviors||[]).concat([Behavior(c)])}},{key:"compatibleLifeCycleDefinition",value:function(e,t,n,o){var r=(0,_Deconstruct.Deconstruct)({},{lifetimes:function(){return{created:function(){t.get("beforeMount").apply(this,arguments)},attached:function(){t.get("mounted").apply(this,arguments)},detached:function(){t.get("beforeDestroy").apply(this,arguments),t.get("destroyed").apply(this,arguments)}}}});o.behaviors=(o.behaviors||[]).concat([Behavior(r)])}},{key:"definitionFilter",value:function(e,t,n,o){this.behaviorLifeCycleDefinition(e,t,n,o),this.compatibleLifeCycleDefinition(e,t,n,o)}},{key:"installBehaviorLifeCycle",value:function(t,n,o){var e,r=t.installers.map(function(e){return e.lifetimes(t,n,o)}).filter(function(e){return!!e}),i=t.installers.map(function(e){return e.pageLifetimes(t,n,o)}).filter(function(e){return!!e});n.set("ready",(e=t.installers.map(function(e){return e.ready}),function(){var t=arguments,n=this;e.forEach(function(e){return e.apply(n,t)})})),n.set("lifetimes",(0,_Deconstruct.Deconstruct)({},{created:function(){var e=r.map(function(e){return e.created}).concat(t.installers.map(function(e){return e.created})).filter(function(e){return(0,_common.isFunction)(e)});return function(){var t=arguments,n=this;e.forEach(function(e){return e.apply(n,t)})}},moved:function(){var e=r.map(function(e){return e.moved}).concat(t.installers.map(function(e){return e.moved})).filter(function(e){return(0,_common.isFunction)(e)});return function(){var t=arguments,n=this;e.forEach(function(e){return e.apply(n,t)})}},attached:function(){var e=r.map(function(e){return e.attached}).concat(t.installers.map(function(e){return e.attached})).filter(function(e){return(0,_common.isFunction)(e)});return function(){var t=arguments,n=this;e.forEach(function(e){return e.apply(n,t)})}},detached:function(){var e=r.map(function(e){return e.detached}).concat(t.installers.map(function(e){return e.detached})).filter(function(e){return(0,_common.isFunction)(e)});return function(){var t=arguments,n=this;e.forEach(function(e){return e.apply(n,t)})}}})),n.set("pageLifetimes",(0,_Deconstruct.Deconstruct)({},{show:function(){var e=i.map(function(e){return e.show}).filter(function(e){return(0,_common.isFunction)(e)});return function(){var t=arguments,n=this;e.forEach(function(e){return e.apply(n,t)})}},hide:function(){var e=i.map(function(e){return e.hide}).filter(function(e){return(0,_common.isFunction)(e)});return function(){var t=arguments,n=this;e.forEach(function(e){return e.apply(n,t)})}},resize:function(){var e=i.map(function(e){return e.resize}).filter(function(e){return(0,_common.isFunction)(e)});return function(){var t=arguments,n=this;e.forEach(function(e){return e.apply(n,t)})}}}))}},{key:"installCompatibleLifeCycle",value:function(e,t,n){var o,r,i,c,u;t.set("beforeCreate",(o=e.installers.map(function(e){return e.beforeCreate}).filter(function(e){return(0,_common.isFunction)(e)}),function(){var t=arguments,n=this;o.forEach(function(e){return e.apply(n,t)})})),t.set("beforeMount",(r=e.installers.map(function(e){return e.beforeMount}).filter(function(e){return(0,_common.isFunction)(e)}),function(){var t=arguments,n=this;r.forEach(function(e){return e.apply(n,t)})})),t.set("mounted",(i=e.installers.map(function(e){return e.mounted}).filter(function(e){return(0,_common.isFunction)(e)}),function(){var t=arguments,n=this;i.forEach(function(e){return e.apply(n,t)})})),t.set("beforeDestroy",(c=e.installers.map(function(e){return e.beforeDestroy}).filter(function(e){return(0,_common.isFunction)(e)}),function(){var t=arguments,n=this;c.forEach(function(e){return e.apply(n,t)})})),t.set("destroyed",(u=e.installers.map(function(e){return e.destroyed}).filter(function(e){return(0,_common.isFunction)(e)}),function(){var t=arguments,n=this;u.forEach(function(e){return e.apply(n,t)})}))}},{key:"installOptionsLifeCycle",value:function(e,t,n){var o;t.set("beforeCreate",(o=n.beforeCreate,(0,_Invocation.Invocation)(t.get("beforeCreate"),null,o))),t.set("beforeMount",(o=n.beforeMount,(0,_Invocation.Invocation)(t.get("beforeMount"),null,o))),t.set("mounted",(o=n.mounted,(0,_Invocation.Invocation)(t.get("mounted"),null,o))),t.set("beforeDestroy",(o=n.beforeDestroy,(0,_Invocation.Invocation)(t.get("beforeDestroy"),null,o))),t.set("destroyed",(n=n.destroyed,(0,_Invocation.Invocation)(t.get("destroyed"),null,n)))}},{key:"lifetimes",value:function(e,t,n){var o=n.lifetimes,r=n.created,i=n.attached,c=n.moved,u=n.detached;return(0,_Deconstruct.Deconstruct)(n,{created:null,attached:null,moved:null,detached:null,lifetimes:null}),{created:o&&o.created?o.created:r,attached:o&&o.attached?o.attached:i,moved:o&&o.moved?o.moved:c,detached:o&&o.detached?o.detached:u}}},{key:"pageLifetimes",value:function(e,t,n){var o=n.pageLifetimes,r=n.onShow,i=n.onHide,c=n.onResize;return(0,_Deconstruct.Deconstruct)(n,{onShow:null,onHide:null,onResize:null,pageLifetimes:null}),{show:o&&o.show?o.show:r,hide:o&&o.hide?o.hide:i,resize:o&&o.resize?o.resize:c}}},{key:"install",value:function(e,t,n){this.installBehaviorLifeCycle(e,t,n),this.installCompatibleLifeCycle(e,t,n),this.installOptionsLifeCycle(e,t,n);var o=n.onLoad,r=n.onShow,i=n.onReady,c=n.onHide,u=n.onUnload,a=n.onPullDownRefresh,f=n.onReachBottom,s=n.onShareAppMessage,l=n.onShareTimeline,p=n.onAddToFavorites,d=n.onTabItemTap,h=n.onPageScroll,y=n.onResize,e=n.ready,n=n.error;t.set("lifecycle",(0,_common.removeEmpty)({onLoad:o,onShow:r,onReady:i,onHide:c,onUnload:u,onPullDownRefresh:a,onReachBottom:f,onShareAppMessage:s,onShareTimeline:l,onAddToFavorites:p,onTabItemTap:d,onPageScroll:h,onResize:y,ready:e,error:n}))}},{key:"build",value:function(e,t,n){n=n.definitionFilter;return Object.assign({},t.get("lifecycle"),(0,_common.removeEmpty)({definitionFilter:n}))}}]),t}();exports.default=LifeCycleInstaller;
"use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _OptionInstaller2=_interopRequireDefault(require("./OptionInstaller")),_common=require("../utils/common"),_Deconstruct=require("../libs/Deconstruct"),_Invocation=require("../libs/Invocation");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),e}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_setPrototypeOf(e,t)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _createSuper(n){var o=_isNativeReflectConstruct();return function(){var e,t=_getPrototypeOf(n);return _possibleConstructorReturn(this,o?(e=_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function _possibleConstructorReturn(e,t){if(t&&("object"===_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(e)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var LifeCycleInstaller=function(){_inherits(t,_OptionInstaller2["default"]);var e=_createSuper(t);function t(){return _classCallCheck(this,t),e.apply(this,arguments)}return _createClass(t,[{key:"behaviorLifeCycleDefinition",value:function(e,t,n,o){var r=arguments,i=this,c=(0,_Deconstruct.Deconstruct)({},{ready:function(){return function(){t.get("ready").apply(this,arguments)}},lifetimes:function(){return{created:function(){t.get("lifetimes").created.apply(this,arguments)},moved:function(){t.get("lifetimes").moved.apply(i,r)},attached:function(){t.get("lifetimes").attached.apply(this,arguments)},detached:function(){t.get("lifetimes").detached.apply(this,arguments)}}},pageLifetimes:function(){return{show:function(){t.get("pageLifetimes").show.apply(this,arguments)},hide:function(){t.get("pageLifetimes").hide.apply(this,arguments)},resize:function(){t.get("pageLifetimes").resize.apply(this,arguments)}}}});o.behaviors=(o.behaviors||[]).concat([Behavior(c)])}},{key:"compatibleLifeCycleDefinition",value:function(e,t,n,o){var r=(0,_Deconstruct.Deconstruct)({},{lifetimes:function(){return{created:function(){t.get("beforeMount").apply(this,arguments)},attached:function(){t.get("mounted").apply(this,arguments)},detached:function(){t.get("beforeDestroy").apply(this,arguments),t.get("destroyed").apply(this,arguments)}}}});o.behaviors=(o.behaviors||[]).concat([Behavior(r)])}},{key:"definitionFilter",value:function(e,t,n,o){this.behaviorLifeCycleDefinition(e,t,n,o),this.compatibleLifeCycleDefinition(e,t,n,o)}},{key:"installBehaviorLifeCycle",value:function(t,n,o){var e,r=t.installers.map(function(e){return e.lifetimes(t,n,o)}).filter(function(e){return!!e}),i=t.installers.map(function(e){return e.pageLifetimes(t,n,o)}).filter(function(e){return!!e});n.set("ready",(e=t.installers.map(function(e){return e.ready}),function(){var t=arguments,n=this;e.forEach(function(e){return e.apply(n,t)})})),n.set("lifetimes",(0,_Deconstruct.Deconstruct)({},{created:function(){var e=r.map(function(e){return e.created}).concat(t.installers.map(function(e){return e.created})).filter(function(e){return(0,_common.isFunction)(e)});return function(){var t=arguments,n=this;e.forEach(function(e){return e.apply(n,t)})}},moved:function(){var e=r.map(function(e){return e.moved}).concat(t.installers.map(function(e){return e.moved})).filter(function(e){return(0,_common.isFunction)(e)});return function(){var t=arguments,n=this;e.forEach(function(e){return e.apply(n,t)})}},attached:function(){var e=r.map(function(e){return e.attached}).concat(t.installers.map(function(e){return e.attached})).filter(function(e){return(0,_common.isFunction)(e)});return function(){var t=arguments,n=this;e.forEach(function(e){return e.apply(n,t)})}},detached:function(){var e=r.map(function(e){return e.detached}).concat(t.installers.map(function(e){return e.detached})).filter(function(e){return(0,_common.isFunction)(e)});return function(){var t=arguments,n=this;e.forEach(function(e){return e.apply(n,t)})}}})),n.set("pageLifetimes",(0,_Deconstruct.Deconstruct)({},{show:function(){var e=i.map(function(e){return e.show}).filter(function(e){return(0,_common.isFunction)(e)});return function(){var t=arguments,n=this;e.forEach(function(e){return e.apply(n,t)})}},hide:function(){var e=i.map(function(e){return e.hide}).filter(function(e){return(0,_common.isFunction)(e)});return function(){var t=arguments,n=this;e.forEach(function(e){return e.apply(n,t)})}},resize:function(){var e=i.map(function(e){return e.resize}).filter(function(e){return(0,_common.isFunction)(e)});return function(){var t=arguments,n=this;e.forEach(function(e){return e.apply(n,t)})}}}))}},{key:"installCompatibleLifeCycle",value:function(e,t,n){var o,r,i,c,u;t.set("beforeCreate",(o=e.installers.map(function(e){return e.beforeCreate}).filter(function(e){return(0,_common.isFunction)(e)}),function(){var t=arguments,n=this;o.forEach(function(e){return e.apply(n,t)})})),t.set("beforeMount",(r=e.installers.map(function(e){return e.beforeMount}).filter(function(e){return(0,_common.isFunction)(e)}),function(){var t=arguments,n=this;r.forEach(function(e){return e.apply(n,t)})})),t.set("mounted",(i=e.installers.map(function(e){return e.mounted}).filter(function(e){return(0,_common.isFunction)(e)}),function(){var t=arguments,n=this;i.forEach(function(e){return e.apply(n,t)})})),t.set("beforeDestroy",(c=e.installers.map(function(e){return e.beforeDestroy}).filter(function(e){return(0,_common.isFunction)(e)}),function(){var t=arguments,n=this;c.forEach(function(e){return e.apply(n,t)})})),t.set("destroyed",(u=e.installers.map(function(e){return e.destroyed}).filter(function(e){return(0,_common.isFunction)(e)}),function(){var t=arguments,n=this;u.forEach(function(e){return e.apply(n,t)})}))}},{key:"installOptionsLifeCycle",value:function(e,t,n){var o;t.set("beforeCreate",(o=n.beforeCreate,(0,_Invocation.Invocation)(t.get("beforeCreate"),null,o))),t.set("beforeMount",(o=n.beforeMount,(0,_Invocation.Invocation)(t.get("beforeMount"),null,o))),t.set("mounted",(o=n.mounted,(0,_Invocation.Invocation)(t.get("mounted"),null,o))),t.set("beforeDestroy",(o=n.beforeDestroy,(0,_Invocation.Invocation)(t.get("beforeDestroy"),null,o))),t.set("destroyed",(n=n.destroyed,(0,_Invocation.Invocation)(t.get("destroyed"),null,n)))}},{key:"lifetimes",value:function(e,t,n){var o=n.lifetimes,r=n.created,i=n.attached,c=n.moved,u=n.detached;return(0,_Deconstruct.Deconstruct)(n,{created:null,attached:null,moved:null,detached:null,lifetimes:null}),{created:o&&o.created?o.created:r,attached:o&&o.attached?o.attached:i,moved:o&&o.moved?o.moved:c,detached:o&&o.detached?o.detached:u}}},{key:"pageLifetimes",value:function(e,t,n){var o=n.pageLifetimes,r=n.onShow,i=n.onHide,c=n.onResize;return(0,_Deconstruct.Deconstruct)(n,{onShow:null,onHide:null,onResize:null,pageLifetimes:null}),{show:o&&o.show?o.show:r,hide:o&&o.hide?o.hide:i,resize:o&&o.resize?o.resize:c}}},{key:"install",value:function(e,t,n){this.installBehaviorLifeCycle(e,t,n),this.installCompatibleLifeCycle(e,t,n),this.installOptionsLifeCycle(e,t,n);var o=n.onLoad,r=n.onShow,i=n.onReady,c=n.onHide,u=n.onUnload,a=n.onPullDownRefresh,f=n.onReachBottom,s=n.onShareAppMessage,l=n.onShareTimeline,p=n.onAddToFavorites,d=n.onTabItemTap,h=n.onPageScroll,e=n.onResize,y=n.ready,n=n.error;t.set("lifecycle",(0,_common.removeEmpty)({onLoad:o,onShow:r,onReady:i,onHide:c,onUnload:u,onPullDownRefresh:a,onReachBottom:f,onShareAppMessage:s,onShareTimeline:l,onAddToFavorites:p,onTabItemTap:d,onPageScroll:h,onResize:e,ready:function(){(0,_common.isFunction)(y)&&y.apply(this,arguments),(0,_common.isFunction)(i)&&i.apply(this,arguments)},error:n}))}},{key:"build",value:function(e,t,n){n=n.definitionFilter;return Object.assign({},t.get("lifecycle"),(0,_common.removeEmpty)({definitionFilter:n}))}}]),t}();exports.default=LifeCycleInstaller;
{
"name": "wechat-mini-program-extend",
"version": "1.0.7",
"version": "1.0.8",
"repository": "git@github.com:sitorhy/wechat-mini-program-extend.git",

@@ -5,0 +5,0 @@ "author": "sitorhy <sitorhy>",

@@ -427,3 +427,3 @@ # wechat-mini-program-extend

指向父组件或页面。
小程序relations执行在attached/mounted回调之后,Component需要在ready生命周期中进行首次访问。
小程序`relations`执行在`attached/mounted`回调之后,需要在`ready/onReady`生命周期中进行首次访问。

@@ -435,3 +435,3 @@ <br>

与当前实例有直接关系的子组件,`$children`不保证任何方式顺序的排列。
Component在ready生命周期中进行首次访问,Page在onLoad中访问。
`在`ready/onReady/onLoad`中获取。

@@ -438,0 +438,0 @@ <br>

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc