3.05 kBSource Map (JSON)View Raw
1{"version":3,"sources":["../../../next-server/lib/mitt.ts"],"names":["mitt","all","Object","create","on","type","handler","push","off","splice","indexOf","emit","evts","slice","map"],"mappings":"0DAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,E,CAEA;AACA;AACA;AAUe,QAASA,CAAAA,IAAT,EAAqC,CAClD,KAAMC,CAAAA,GAA+B,CAAGC,MAAM,CAACC,MAAP,CAAc,IAAd,CAAxC,CAEA,MAAO,CACLC,EAAE,CAACC,IAAD,CAAeC,OAAf,CAAiC,CACjC,CAAC,CAACL,GAAG,CAACI,IAAD,CAAH,GAAcJ,GAAG,CAACI,IAAD,CAAH,CAAY,EAA1B,CAAD,EAAgCE,IAAhC,CAAqCD,OAArC,EACF,CAHI,CAKLE,GAAG,CAACH,IAAD,CAAeC,OAAf,CAAiC,CAClC,GAAIL,GAAG,CAACI,IAAD,CAAP,CAAe,CACbJ,GAAG,CAACI,IAAD,CAAH,CAAUI,MAAV,CAAiBR,GAAG,CAACI,IAAD,CAAH,CAAUK,OAAV,CAAkBJ,OAAlB,IAA+B,CAAhD,CAAmD,CAAnD,EACD,CACF,CATI,CAWLK,IAAI,CAACN,IAAD,CAAe,GAAGO,IAAlB,CAA+B,CACjC;AACA,CAAC,CAACX,GAAG,CAACI,IAAD,CAAH,EAAa,EAAd,EAAkBQ,KAAlB,GAA0BC,GAA1B,CAA+BR,OAAD,EAAsB,CACnDA,OAAO,CAAC,GAAGM,IAAJ,CAAP,CACD,CAFA,EAGF,CAhBI,CAAP,CAkBD","sourcesContent":["/*\nMIT License\n\nCopyright (c) Jason Miller (https://jasonformat.com/)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\n// This file is based on https://github.com/developit/mitt/blob/v1.1.3/src/index.js\n// It's been edited for the needs of this script\n// See the LICENSE at the top of the file\n\ntype Handler = (...evts: any[]) => void\n\nexport type MittEmitter<T> = {\n on(type: T, handler: Handler): void\n off(type: T, handler: Handler): void\n emit(type: T, ...evts: any[]): void\n}\n\nexport default function mitt(): MittEmitter<string> {\n const all: { [s: string]: Handler[] } = Object.create(null)\n\n return {\n on(type: string, handler: Handler) {\n ;(all[type] || (all[type] = [])).push(handler)\n },\n\n off(type: string, handler: Handler) {\n if (all[type]) {\n all[type].splice(all[type].indexOf(handler) >>> 0, 1)\n }\n },\n\n emit(type: string, ...evts: any[]) {\n // eslint-disable-next-line array-callback-return\n ;(all[type] || []).slice().map((handler: Handler) => {\n handler(...evts)\n })\n },\n }\n}\n"]}
\No newline at end of file