- 电子药箱: 药品库存管理 + 手动录入 + 今日用药打卡 - 药品百科: 搜索 + 分类筛选 + 20种药品静态数据 - 惠教中心: 4条药品使用指南课程 - 我的: 家庭成员信息管理 - 自定义TabBar + navigation-bar组件 - SVG药品分类插图
1 line
2.3 KiB
JavaScript
1 line
2.3 KiB
JavaScript
"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},_typeof(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 o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,_toPropertyKey(r.key),r)}}function _createClass(e,t,o){return t&&_defineProperties(e.prototype,t),o&&_defineProperties(e,o),Object.defineProperty(e,"prototype",{writable:!1}),e}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"===_typeof(t)?t:String(t)}function _toPrimitive(e,t){if("object"!==_typeof(e)||null===e)return e;var o=e[Symbol.toPrimitive];if(void 0!==o){var r=o.call(e,t||"default");if("object"!==_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var EventEmitter=function(){function e(){_classCallCheck(this,e)}return _createClass(e,[{key:"on",value:function(e,t,o){"function"==typeof t?(this._stores=this._stores||{},(this._stores[e]=this._stores[e]||[]).push({cb:t,ctx:o})):console.error("fn must be a function")}},{key:"once",value:function(e,t,o){var r=this;if("function"==typeof t){var i=function i(){r.off(e,i);for(var n=arguments.length,s=new Array(n),l=0;l<n;l++)s[l]=arguments[l];t.apply(o,s)};i._origin=t,this.on(e,i,o)}else console.error("fn must be a function")}},{key:"emit",value:function(e){this._stores=this._stores||{};var t,o=this._stores[e];if(o){o=o.slice(0),t=[].slice.call(arguments,1);for(var r=0,i=o.length;r<i;r++)o[r].cb.apply(o[r].ctx,t)}}},{key:"off",value:function(e,t){if(this._stores=this._stores||{},arguments.length){var o=this._stores[e];if(o)if(1!==arguments.length)for(var r=o.length-1;r>=0;r--){var i,n,s;t!==(null===(i=o[r])||void 0===i?void 0:i.cb)&&t!==(null===(n=o[r])||void 0===n||null===(s=n.cb)||void 0===s?void 0:s._origin)||o.splice(r,1)}else delete this._stores[e]}else this._stores={}}},{key:"removeAllListeners",value:function(e){this._stores=this._stores||{},e?delete this._stores[e]:this._stores={}}}]),e}();module.exports=EventEmitter; |