{"id":18264863,"url":"https://github.com/bem/bem-history","last_synced_at":"2025-04-04T21:30:55.204Z","repository":{"id":9459593,"uuid":"11341198","full_name":"bem/bem-history","owner":"bem","description":"BEM wrap for History API","archived":false,"fork":false,"pushed_at":"2018-01-19T21:57:10.000Z","size":209,"stargazers_count":23,"open_issues_count":7,"forks_count":21,"subscribers_count":16,"default_branch":"v4","last_synced_at":"2025-03-20T19:17:28.710Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://bem.info/libs/bem-history/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bem.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-07-11T12:17:23.000Z","updated_at":"2024-10-04T01:03:11.000Z","dependencies_parsed_at":"2022-09-02T13:31:03.907Z","dependency_job_id":null,"html_url":"https://github.com/bem/bem-history","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bem%2Fbem-history","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bem%2Fbem-history/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bem%2Fbem-history/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bem%2Fbem-history/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bem","download_url":"https://codeload.github.com/bem/bem-history/tar.gz/refs/heads/v4","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247252037,"owners_count":20908613,"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":[],"created_at":"2024-11-05T11:16:20.451Z","updated_at":"2025-04-04T21:30:54.878Z","avatar_url":"https://github.com/bem.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"bem-history\n===========\n\n## What is this?\nBEM wrap for History API:\n* supports browsers with a native History API and hashchange event;\n* provides manipulations with url, browser location and history in the terms of [BEM](http://bem.info/).\n\n## Components\n\n* `uri__querystring` – module for an url parsing;\n* `history` – module provides work with a browser History with two modificators:\n * `provider_history-api` – supports a native History API;\n * `provider_hashchange` – supports fallback on the hashchange event;\n* `location` – high-level module for a `window.location` change.\n\n## Scheme of library work\n\n![bem-history workflow](https://cdn.rawgit.com/bem/bem-history/v4/bem-history_from-browser.svg)\n\n## Usage\n\n### uri__querystring\n```js\nmodules.require(['uri__querystring'], function(Querystring) {\n\n    // Parse url\n    var u = Querystring.Uri.parse('http://example.org:8080/path?test=1\u0026test=2\u0026param2=22');\n\n    // Change port\n    u.setPort(80);\n\n    // Change query params\n    u.deleteParam('test', '2');\n    u.replaceParam('param2', 2);\n\n    // Serialize url\n    u.toString(); // \"http://example.org:80/path?test=1\u0026param2=2\"\n\n});\n```\n\n### history\n```js\nmodules.require(['history'], function(History) {\n\n    // Create history instance\n    var history = new History();\n\n    // Push new or replace history state\n    history.changeState('push', { title: 'Title', url: 'http://example.org:8080/path' });\n    history.changeState('replace', { title: 'Title', url: 'http://example.org:8080/path?test=1' });\n\n});\n```\n\n### location\n```js\nmodules.require(['location'], function(location) {\n\n    // Change `window.location` using a full url\n    location.change({ url: 'http://example.org:8080/path' });\n\n    // Change current location using only the new query params\n    location.change({ params: { param1: [11,12], param2: 'ololo' } });\n    window.location.href; // \"http://example.org:8080/path?param1=11\u0026param1=12\u0026param2=ololo\"\n\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbem%2Fbem-history","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbem%2Fbem-history","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbem%2Fbem-history/lists"}