{"id":15893923,"url":"https://github.com/chinanf-boy/explain-scrollreveal","last_synced_at":"2026-02-01T03:38:57.092Z","repository":{"id":90548232,"uuid":"115239762","full_name":"chinanf-boy/explain-scrollreveal","owner":"chinanf-boy","description":"explain scrollreveal easy anim ","archived":false,"fork":false,"pushed_at":"2018-01-20T11:03:01.000Z","size":41,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-19T22:08:08.022Z","etag":null,"topics":["explain","explain-scrollreveal","scrollreveal"],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chinanf-boy.png","metadata":{"files":{"readme":"README.clean.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-12-24T04:27:42.000Z","updated_at":"2018-01-05T12:53:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"a2c9bb8e-7095-47c1-b60a-2744b0e7ecd5","html_url":"https://github.com/chinanf-boy/explain-scrollreveal","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/chinanf-boy/explain-scrollreveal","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chinanf-boy%2Fexplain-scrollreveal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chinanf-boy%2Fexplain-scrollreveal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chinanf-boy%2Fexplain-scrollreveal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chinanf-boy%2Fexplain-scrollreveal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chinanf-boy","download_url":"https://codeload.github.com/chinanf-boy/explain-scrollreveal/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chinanf-boy%2Fexplain-scrollreveal/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28966843,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-01T02:14:24.993Z","status":"ssl_error","status_checked_at":"2026-02-01T02:13:55.706Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["explain","explain-scrollreveal","scrollreveal"],"created_at":"2024-10-06T08:14:04.805Z","updated_at":"2026-02-01T03:38:57.080Z","avatar_url":"https://github.com/chinanf-boy.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# clean \n\n衔接 [README.reveal.md](./README.reveal.md#L413)\n\n`reveal` [函数-代码使用](./README.reveal.md#191)\n\n## 作用在于清除 元素数组缓存\n\n``` js\n/**\n * Verify the current device passes our platform configuration, // 确认 设备平台\n * and cache the result for the rest of the loop.\n * // 缓存 循环的结果\n */\nlet disabled\n{\n\tif (disabled == null) {\n\t\t// 是否 在移动端 或者 桌面端 中的一个就行\n\t\tdisabled = (!config.mobile \u0026\u0026 isMobile()) || (!config.desktop \u0026\u0026 !isMobile())\n\t}\n\tif (disabled) { // 无法识别 平台 返回\n\t// 一般来说这一步，在第一次 reduce 函数 就会识别出来\n\t\tif (existingId) {\n            clean.call(this, element) // 清除-缓存数组\n            // \u003c------\n\t\t}\n\t\treturn elementBuffer\n\t\t// 所以一般，return []\n\t}\n}\n// ...\n```\n\n---\n\n## `clean.call(this,element)`\n\n- this == reveal 函数\n\n- element == target\n\n[clean.js](./explain-scrollreveal/scrollreveal/src/instance/methods/clean.js)\n``` js\nimport { each, getNodes } from 'tealight'\nimport { logger } from '../../utils/core'\nimport rinse from '../functions/rinse'\n\nexport default function clean (target) {\n\tlet dirty\n\ttry {\n\t\teach(getNodes(target), node =\u003e {\n\t\t\tconst id = node.getAttribute('data-sr-id')\n\t\t\tif (id !== null) {\n                dirty = true\n                // this.store 是 全局缓存\n                const element = this.store.elements[id]\n                // 动画函数-执行-去除\n\t\t\t\tif (element.callbackTimer) {\n\t\t\t\t\twindow.clearTimeout(element.callbackTimer.clock)\n                }\n                // 拆卸 id ，安装 原style\n\t\t\t\tnode.setAttribute('style', element.styles.inline.generated)\n                node.removeAttribute('data-sr-id')\n                // 删除 目标元素 在 全局缓存\n\t\t\t\tdelete this.store.elements[id]\n\t\t\t}\n\t\t})\n\t} catch (e) {\n\t\treturn logger.call(this, 'Clean failed.', e.stack || e.message)\n\t}\n\n\tif (dirty) {\n        // 残留数据\n\t\ttry {\n\t\t\trinse.call(this) //\n\t\t} catch (e) {\n\t\t\treturn logger.call(this, 'Clean failed.', e.stack || e.message)\n\t\t}\n\t}\n}\n\n```\n\n- element.callbackTimer \n\n\u003e ?\n\n- rinse.call(this)\n\n\u003e 冲洗内存\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchinanf-boy%2Fexplain-scrollreveal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchinanf-boy%2Fexplain-scrollreveal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchinanf-boy%2Fexplain-scrollreveal/lists"}