{"id":13725567,"url":"https://github.com/argyleink/blingblingjs","last_synced_at":"2025-04-05T09:10:10.520Z","repository":{"id":32610318,"uuid":"127696091","full_name":"argyleink/blingblingjs","owner":"argyleink","description":"💲 Micro-library of shorthands for DOM selection, events, and attribute manipulation","archived":false,"fork":false,"pushed_at":"2024-01-17T02:55:15.000Z","size":442,"stargazers_count":234,"open_issues_count":7,"forks_count":16,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-29T08:06:34.730Z","etag":null,"topics":["commonjs","dom-manipulation","es6","javascript","jquery-like","tdd","utility-function"],"latest_commit_sha":null,"homepage":"","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/argyleink.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-04-02T03:08:00.000Z","updated_at":"2025-03-13T00:21:40.000Z","dependencies_parsed_at":"2024-01-06T01:54:23.746Z","dependency_job_id":"b2a57513-33f2-4785-8199-be073e2189fb","html_url":"https://github.com/argyleink/blingblingjs","commit_stats":{"total_commits":47,"total_committers":7,"mean_commits":6.714285714285714,"dds":0.3829787234042553,"last_synced_commit":"601d4e82a0dabffc3c430d673f69994180a3f3ca"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/argyleink%2Fblingblingjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/argyleink%2Fblingblingjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/argyleink%2Fblingblingjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/argyleink%2Fblingblingjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/argyleink","download_url":"https://codeload.github.com/argyleink/blingblingjs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247312085,"owners_count":20918344,"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":["commonjs","dom-manipulation","es6","javascript","jquery-like","tdd","utility-function"],"created_at":"2024-08-03T01:02:27.573Z","updated_at":"2025-04-05T09:10:10.426Z","avatar_url":"https://github.com/argyleink.png","language":"JavaScript","readme":"# BlingBlingJS\n\u003cp style=\"text-align='center'\"\u003e\n  \u003cimg src=\"https://github.com/argyleink/blingblingjs/actions/workflows/main.yml/badge.svg\" alt=\"Build Status\"\u003e\n  \u003cimg src=\"https://img.shields.io/npm/dt/blingblingjs.svg\" alt=\"Total Downloads\"\u003e\n  \u003cimg src=\"https://img.shields.io/npm/v/blingblingjs.svg\" alt=\"Latest Release\"\u003e\n  \u003cimg src=\"https://img.shields.io/npm/l/blingblingjs.svg\" alt=\"License\"\u003e\n\u003c/p\u003e\n\n\u003e like [bling.js](https://gist.github.com/paulirish/12fb951a8b893a454b32), but more bling\n\n\u003cbr\u003e\n\n###### Getting Started\n### Installation\n```bash\nnpm i blingblingjs\n```\n\n### Importing\n```js\n// import the blingbling y'all\nimport $ from 'blingblingjs'                // es6 module\nconst $ = require('blingblingjs')           // commonjs\n\n// or from Pika CDN! https://cdn.pika.dev/blingblingjs/v2\n```\n\n### [Bookmarklet](https://github.com/argyleink/blingblingjs/issues/42)\n```js\njavascript: fetch('https://cdn.jsdelivr.net/npm/blingblingjs@latest/dist/index.min.js').then((x) =\u003e x.text()).then((x) =\u003e {\n  eval(x); $ = $.default;\n  console.log(\"💲 BlingBlingJS ready 💲\");\n});\n```\n\n\u003cbr\u003e\n\n###### Syntax\n\n### Quick Overview\n```js\n$()        // select nodes in document or pass nodes in\n$().on     // add multiple event listeners to multiple nodes\n$().off    // remove multiple event listeners from multiple nodes\n$().attr   // CRUD attributes on nodes\n$().map    // use native array methods\n```\n\n\u003cbr\u003e\n\n### Queries\n```js\n// get nodes from the document\nconst btns         = $('button')            // blingbling always returns an array\nconst [first_btn]  = $('button[primary]')   // destructure shortcut for 1st/only match\nconst btn_spans    = $('span', btns)        // provide a query context by passing a 2nd param of node/nodes\n\n// cover DOM nodes in bling\nconst [sugared_single]  = $(document.querySelector('button'))\nconst sugared_buttons   = $(document.querySelectorAll('button'))\n```\n\n\u003cbr\u003e\n\n### Array Methods\n```js\n$('button').forEach(...)\n$('button').map(...)\n\nconst btns = $('button')\nbtns.filter(...)\nbtns.reduce(...)\nbtns.flatMap(...)\n...\n```\n\n\u003cbr\u003e\n\n### Events\n```js\n// single events\nfirst_btn.on('click', ({target}) =\u003e console.log(target))\n$('button[primary]').on('click', e =\u003e console.log(e))\n\n// single events with options\nfirst_btn.on('click', ({target}) =\u003e console.log(target), {once: true})\n$('button[primary]').on('click', e =\u003e console.log(e), true) // useCapture\n\n// multiple events\n$('h1').on('click touchend', ({target}) =\u003e console.log(target))\n\n// remove events\nconst log_event = e =\u003e console.warn(e) // must have a reference to the original function\nmain_btn.on('contextmenu', log_event)\nmain_btn.off('contextmenu', log_event)\n```\n\n\u003cbr\u003e\n\n### Attributes\n```js\n// set an attribute\n$('button.rad').attr('rad', true)\n\n// set multiple attributes\nconst [rad_btn] = $('button.rad')\nrad_btn.attr({\n  test: 'foo',\n  hi:   'bye',\n})\n\n// get an attribute\nrad_btn.attr('rad')        // \"true\"\nrad_btn.attr('hi')         // \"bye\"\n\n// get multiple attributes\n$('button').map(btn =\u003e ({\n  tests:  btn.attr('tests'),\n  hi:     btn.attr('hi'),\n}))\n\n// remove an attribute\nrad_btn.attr('hi', null)   // set to null to remove\nrad_btn.attr('hi')         // attribute not found\n\n// remove multiple attributes\nbtns.attr({\n  test:   null,\n  hi:     null,\n})\n```\n\n\u003cbr\u003e\n\n### Convenience\n```js\nimport {rIC, rAF} from 'blingblingjs'\n\n// requestAnimationFrame\nrAF(_ =\u003e {\n  // animation tick\n})\n\n// requestIdleCallback\nrIC(_ =\u003e {\n  // good time to compute\n})\n```\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n###### What for?\n**Developer ergonomics!** \nIf you agree with any of the following, you may appreciate this micro library:\n* Love vanilla js, want to keep your code close to it\n* Chaining is fun, Arrays are fun, essentially a functional programming fan\n* Hate typing `document.querySelector` over.. and over.. \n* Hate typing `addEventListener` over.. and over..\n* Really wish `document.querySelectorAll` had array methods on it..\n* Confused that there is no `node.setAttributes({...})` or even better `nodeList.setAttributes({...})`\n* Liked jQuery selector syntax\n\n###### Why BlingBling?\n- Minimal at 0.6kb (636 bytes)\n- BlingBling supports ES6 module importing and common module loading\n- Supports chaining\n- Worth it's weight (should save more characters than it loads)\n- Only enhances the nodes you query with it\n- ES6 version of popular [bling.js](https://gist.github.com/paulirish/12fb951a8b893a454b32) by Paul Irish\n- [Tested](https://github.com/argyleink/blingblingjs/blob/master/src/index.test.js)\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fargyleink%2Fblingblingjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fargyleink%2Fblingblingjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fargyleink%2Fblingblingjs/lists"}