Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
1 line
2.0 KiB
Plaintext
1 line
2.0 KiB
Plaintext
{"version":3,"file":"initUnique.js","sources":["../../../../../src/metrics/web-vitals/lib/initUnique.ts"],"sourcesContent":["/*\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst instanceMap: WeakMap<object, unknown> = new WeakMap();\n\n/**\n * A function that accepts and identity object and a class object and returns\n * either a new instance of that class or an existing instance, if the\n * identity object was previously used.\n */\nexport function initUnique<T>(identityObj: object, ClassObj: new () => T): T {\n try {\n if (!instanceMap.get(identityObj)) {\n instanceMap.set(identityObj, new ClassObj());\n }\n return instanceMap.get(identityObj)! as T;\n } catch (e) {\n // --- START Sentry-custom code (try/catch wrapping) ---\n // Fix for cases where identityObj is not a valid key for WeakMap (sometimes a problem in Safari)\n // Just return a new instance without caching it in instanceMap\n return new ClassObj();\n }\n // --- END Sentry-custom code ---\n}\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAM,WAAW,GAA6B,IAAI,OAAO,EAAE;;AAE3D;AACA;AACA;AACA;AACA;AACO,SAAS,UAAU,CAAI,WAAW,EAAU,QAAQ,EAAkB;AAC7E,EAAE,IAAI;AACN,IAAI,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE;AACvC,MAAM,WAAW,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,QAAQ,EAAE,CAAC;AAClD,IAAI;AACJ,IAAI,OAAO,WAAW,CAAC,GAAG,CAAC,WAAW,CAAC;AACvC,EAAE,CAAA,CAAE,OAAO,CAAC,EAAE;AACd;AACA;AACA;AACA,IAAI,OAAO,IAAI,QAAQ,EAAE;AACzB,EAAE;AACF;AACA;;;;"} |