{"id":16866439,"url":"https://github.com/maxgraey/react-native-console-time-polyfill","last_synced_at":"2025-04-09T17:24:11.460Z","repository":{"id":43175483,"uuid":"84102942","full_name":"MaxGraey/react-native-console-time-polyfill","owner":"MaxGraey","description":"console.time and console.timeEnd polyfill for react-native","archived":false,"fork":false,"pushed_at":"2021-04-03T10:00:14.000Z","size":13,"stargazers_count":106,"open_issues_count":0,"forks_count":7,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-04-26T15:04:39.599Z","etag":null,"topics":["console","measurements","performance","polyfill","react-native","time"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MaxGraey.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-06T17:45:24.000Z","updated_at":"2024-04-09T15:56:26.000Z","dependencies_parsed_at":"2022-08-31T00:31:04.572Z","dependency_job_id":null,"html_url":"https://github.com/MaxGraey/react-native-console-time-polyfill","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaxGraey%2Freact-native-console-time-polyfill","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaxGraey%2Freact-native-console-time-polyfill/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaxGraey%2Freact-native-console-time-polyfill/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaxGraey%2Freact-native-console-time-polyfill/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MaxGraey","download_url":"https://codeload.github.com/MaxGraey/react-native-console-time-polyfill/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248075556,"owners_count":21043614,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["console","measurements","performance","polyfill","react-native","time"],"created_at":"2024-10-13T14:50:36.137Z","updated_at":"2025-04-09T17:24:11.420Z","avatar_url":"https://github.com/MaxGraey.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## react-native-console-time-polyfill\n\nStarts a timer you can use to track how long an operation takes. When you call ***console.timeEnd()/console.timeLog()*** with the same name, the react-native will output the time, in milliseconds, that elapsed since the timer was started.\n\nAlso you can use ***console.count()*** and ***console.countReset()*** for determine number of function calls.\n\n### Installation\n\nInstall library from **npm**\n\n```bash\nnpm install --save react-native-console-time-polyfill\n```\n\nor **yarn**\n\n```bash\nyarn add react-native-console-time-polyfill\n```\n\n### Syntax\n\n```javascript\nconsole.time(label);\nconsole.timeLog(label);\nconsole.timeEnd(label);\n\nconsole.count(label);\nconsole.countReset(label);\n```\n\n### Parameters\n\n***label***\n\nThe name to give the new timer or counter. This will identify the timer or counter.\n\nUse the same name when calling ***console.timeEnd()*** to stop the timer and get the time output to the console.\n\n### Usage\n\nUse the following code:\n\n```javascript\n// in your root javascript / typescript file\nimport 'react-native-console-time-polyfill'\n\n// now you can use polyfill in your components\nexport default function SomeComponent({ children, ...props }) =\u003e {\n  useEffect(() =\u003e { // or useLayoutEffect\n    console.time('SomeComponent(init) time')\n    // \"some slow initialization code\"\n    console.timeEnd('SomeComponent(init) time')\n\n    return () =\u003e {\n      console.countReset('SomeComponent(render) calls')\n    }\n  }, [])\n\n  useEffect(() =\u003e {\n    console.count('SomeComponent(render) calls')\n  })\n\n  return \u003cView {...props}\u003e{ children }\u003c/View\u003e\n}\n```\n\n### Output\n\n```\nSomeComponent(init) time: 200ms\nSomeComponent(render) calls: 2\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxgraey%2Freact-native-console-time-polyfill","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaxgraey%2Freact-native-console-time-polyfill","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxgraey%2Freact-native-console-time-polyfill/lists"}