Skip to content

Commit

Permalink
feat: update
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangtao25 committed Dec 20, 2024
1 parent 860c787 commit 94fc67a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion plugins/babel-plugin-canyon/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "babel-plugin-canyon",
"version": "2.0.0-beta.20",
"version": "2.0.0-beta.21",
"description": "",
"scripts": {
"release": "babel src --extensions \".ts\" --out-dir lib",
Expand Down
2 changes: 1 addition & 1 deletion plugins/babel-plugin-canyon/src/template.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export default {
"templates/write-canyon-to-local-template.js": "(function () {\n var globalObj = undefined;\n try {\n globalObj = new Function('return this')();\n } catch (e) {\n if (typeof window !== \"undefined\") {\n globalObj = window;\n } else if (typeof global !== \"undefined\") {\n globalObj = global;\n } else {\n // do nothing\n }\n }\n if (globalObj){\n\n // ***start***\n\n if (globalObj.isDocumentAddVisibilitychangeWriteCanyonToLocal) {\n } else {\n globalObj.isDocumentAddVisibilitychangeWriteCanyonToLocal = true\n if (globalObj.document && globalObj.document.addEventListener) {\n if (globalObj.writeCanyonToLocal) {\n globalObj.manualWriteCanyonToLocal = function () {\n globalObj.writeCanyonToLocal(JSON.stringify({\n coverage: globalObj.__coverage__,\n canyon: globalObj.__canyon__\n }))\n }\n }\n globalObj.document.addEventListener('visibilitychange', function () {\n if (globalObj.document.visibilityState === 'hidden') {\n if (globalObj.writeCanyonToLocal) {\n globalObj.writeCanyonToLocal(JSON.stringify({\n coverage: globalObj.__coverage__,\n canyon: globalObj.__canyon__\n }))\n } else {\n console.log('writeCanyonToLocal is not defined')\n }\n }\n });\n }\n }\n\n // **end***\n }\n})()\n"
"templates/write-canyon-to-local-template.js": "(function () {\n var globalObj = undefined;\n try {\n globalObj = new Function('return this')();\n } catch (e) {\n if (typeof window !== \"undefined\") {\n globalObj = window;\n } else if (typeof global !== \"undefined\") {\n globalObj = global;\n } else {\n // do nothing\n }\n }\n if (globalObj){\n\n // ***start***\n\n if (globalObj.isDocumentAddVisibilitychangeWriteCanyonToLocal) {\n } else {\n globalObj.isDocumentAddVisibilitychangeWriteCanyonToLocal = true\n if (globalObj.document && globalObj.document.addEventListener) {\n if (globalObj.writeCanyonToLocal) {\n globalObj.manualWriteCanyonToLocal = function () {\n globalObj.writeCanyonToLocal(JSON.stringify({\n coverage: globalObj.__coverage__,\n canyon: globalObj.__canyon__ || (Object.keys(globalObj.__coverage__).length>0?Object.values(globalObj.__coverage__)[0]:undefined)\n }))\n }\n }\n globalObj.document.addEventListener('visibilitychange', function () {\n if (globalObj.document.visibilityState === 'hidden') {\n if (globalObj.writeCanyonToLocal) {\n globalObj.writeCanyonToLocal(JSON.stringify({\n coverage: globalObj.__coverage__,\n canyon: globalObj.__canyon__ || (Object.keys(globalObj.__coverage__).length>0?Object.values(globalObj.__coverage__)[0]:undefined)\n }))\n } else {\n console.log('writeCanyonToLocal is not defined')\n }\n }\n });\n }\n }\n\n // **end***\n }\n})()\n"
}

0 comments on commit 94fc67a

Please sign in to comment.