{"version":3,"sources":["webpack:///./LeLab.Web/src/barba/page-hooks.js"],"names":["lastData","lastHook","barba","hooks","beforeLeave","data","afterLeave","beforeEnter","afterEnter","PageHooks","constructor","this","bind"],"mappings":"yFAAA,oBAgDA,IAAIA,EAAW,KACXC,EAAW,KAEfC,IAAMC,MAAMC,YAAYC,IACpBJ,EATiB,cAUjBD,EAAWK,IAGfH,IAAMC,MAAMG,WAAWD,IACnBJ,EAbgB,aAchBD,EAAWK,IAGfH,IAAMC,MAAMI,YAAYF,IACpBJ,EAjBiB,cAkBjBD,EAAWK,IAGfH,IAAMC,MAAMK,WAAWH,IACnBJ,EArBgB,aAsBhBD,EAAWK,IA4BAI,IAzBf,MACIC,cAEQV,GAAYC,GA7BH,gBA6BeA,GACxBU,KAAKJ,YAAYP,GAIjBA,GAAYC,GAjCJ,eAiCgBA,IACxBU,KAAKJ,YAAYP,GACjBW,KAAKH,WAAWR,IAGpBE,IAAMC,MAAMC,YAAYO,KAAKP,YAAYQ,KAAKD,OAC9CT,IAAMC,MAAMG,WAAWK,KAAKL,WAAWM,KAAKD,OAC5CT,IAAMC,MAAMI,YAAYI,KAAKJ,YAAYK,KAAKD,OAC9CT,IAAMC,MAAMK,WAAWG,KAAKH,WAAWI,KAAKD,OAEhDP,YAAYC,IACZC,WAAWD,IACXE,YAAYF,IACZG,WAAWH","file":"page-hooks.8154a190.js","sourcesContent":["/**\r\n * This class \"PageHooks\" is used to call views hooks\r\n * (beforeLeave, afterLeave, beforeEnter, afterEnter).\r\n * \r\n * This is to facilitate code injection within the SPA to\r\n * initialize next.container, but the script might be delayed\r\n * by the network.\r\n * \r\n * Can be used un 2 ways.\r\n * \r\n * =============================================================\r\n * \r\n * class MyClass extends PageHooks {\r\n * constructor() {\r\n * super()\r\n * }\r\n * beforeEnter(data) { }\r\n * afterEnter(data) { }\r\n * beforeLeave(data) { }\r\n * afterLeave(data) { }\r\n * }\r\n * \r\n * =============================================================\r\n * \r\n * class MyClass extends MyOtherClass {\r\n * constructor() {\r\n * super()\r\n * const beforeEnter = this.beforeEnter.bind(this)\r\n * new class extends PageHooks {\r\n * beforeEnter(data) {\r\n * beforeEnter(data)\r\n * }\r\n * }\r\n * }\r\n * beforeEnter(data) { }\r\n * }\r\n * \r\n * =============================================================\r\n * \r\n */\r\n\r\nimport barba from '@barba/core'\r\n\r\nconst BEFORE_LEAVE = \"beforeLeave\"\r\nconst AFTER_LEAVE = \"afterLeave\"\r\nconst BEFORE_ENTER = \"beforeEnter\"\r\nconst AFTER_ENTER = \"afterEnter\"\r\n\r\nlet lastData = null\r\nlet lastHook = null\r\n\r\nbarba.hooks.beforeLeave(data => {\r\n lastHook = BEFORE_LEAVE\r\n lastData = data\r\n})\r\n\r\nbarba.hooks.afterLeave(data => {\r\n lastHook = AFTER_LEAVE\r\n lastData = data\r\n})\r\n\r\nbarba.hooks.beforeEnter(data => {\r\n lastHook = BEFORE_ENTER\r\n lastData = data\r\n})\r\n\r\nbarba.hooks.afterEnter(data => {\r\n lastHook = AFTER_ENTER\r\n lastData = data\r\n})\r\n\r\nclass PageHooks {\r\n constructor() {\r\n // We missed the \"beforeEnter\" hook\r\n if (lastData && lastHook && lastHook === BEFORE_ENTER) {\r\n this.beforeEnter(lastData)\r\n }\r\n\r\n // We missed the \"beforeEnter\" and \"afterEnter\" hooks\r\n if (lastData && lastHook && lastHook === AFTER_ENTER) {\r\n this.beforeEnter(lastData)\r\n this.afterEnter(lastData)\r\n }\r\n \r\n barba.hooks.beforeLeave(this.beforeLeave.bind(this))\r\n barba.hooks.afterLeave(this.afterLeave.bind(this))\r\n barba.hooks.beforeEnter(this.beforeEnter.bind(this))\r\n barba.hooks.afterEnter(this.afterEnter.bind(this))\r\n }\r\n beforeLeave(data) { }\r\n afterLeave(data) { }\r\n beforeEnter(data) { }\r\n afterEnter(data) { }\r\n}\r\n\r\nexport { PageHooks }\r\nexport default PageHooks"],"sourceRoot":""}