{"id":18429431,"url":"https://github.com/bigpipe/bootstrap-pagelet","last_synced_at":"2025-04-13T21:44:31.022Z","repository":{"id":24814817,"uuid":"28229132","full_name":"bigpipe/bootstrap-pagelet","owner":"bigpipe","description":"Base Pagelet that is responsible for bootstrapping the client side of BigPipe","archived":false,"fork":false,"pushed_at":"2020-10-26T13:17:26.000Z","size":50,"stargazers_count":0,"open_issues_count":2,"forks_count":1,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-19T01:17:07.269Z","etag":null,"topics":[],"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/bigpipe.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":"2014-12-19T12:46:33.000Z","updated_at":"2020-10-26T13:17:28.000Z","dependencies_parsed_at":"2022-08-23T06:50:59.866Z","dependency_job_id":null,"html_url":"https://github.com/bigpipe/bootstrap-pagelet","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigpipe%2Fbootstrap-pagelet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigpipe%2Fbootstrap-pagelet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigpipe%2Fbootstrap-pagelet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigpipe%2Fbootstrap-pagelet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bigpipe","download_url":"https://codeload.github.com/bigpipe/bootstrap-pagelet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248788868,"owners_count":21161726,"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-06T05:17:10.924Z","updated_at":"2025-04-13T21:44:30.995Z","avatar_url":"https://github.com/bigpipe.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bootstrap Pagelet\n\n[![Version npm][version]](http://browsenpm.org/package/bootstrap-pagelet)[![Build Status][build]](https://travis-ci.org/bigpipe/bootstrap-pagelet)[![Dependencies][david]](https://david-dm.org/bigpipe/bootstrap-pagelet)[![Coverage Status][cover]](https://coveralls.io/r/bigpipe/bootstrap-pagelet?branch=master)\n\n[version]: http://img.shields.io/npm/v/bootstrap-pagelet.svg?style=flat-square\n[build]: http://img.shields.io/travis/bigpipe/bootstrap-pagelet/master.svg?style=flat-square\n[david]: https://img.shields.io/david/bigpipe/bootstrap-pagelet.svg?style=flat-square\n[cover]: http://img.shields.io/coveralls/bigpipe/bootstrap-pagelet/master.svg?style=flat-square\n\nThis Pagelet is responsible for bootstrapping the client side\nof BigPipe and keeping state on the child pagelet queue. By default\nthe Bootstrap Pagelet is provided with BigPipe. However, if you\nrequire a custom Bootstrap you can extend this Pagelet.\n\n## Installation\n\nThe boostrap Pagelet is distributed through the node package manager (npm).\n\n```\nnpm install --save bootstrap-pagelet\n```\n\n## Support\n\nCreate an issue. Every question you have is a bug in our\ndocumentation and that should be corrected. So please, don't hesitate to create\nissues, many of them.\n\n### Example\n\nIn this example the Bootstrap Pagelet is extended with a custom view.\nFor instance, if you want to use a custom layout or have several repeating\npagelets that always need to be added. BigPipe will automatically\ndiscover this extended version if it is provided to BigPipe alongside\nthe other pagelets.\n\n```js\n'use strict';\n\n//\n// Extend the Bootstrap Pagelet with a custom view.\n//\nvar Bootstrap = require('bootstrap-pagelet').extend({\n  view: '/path/to/my/custom-view.html'\n});\n\n//\n// Initialise BigPipe server.\n//\nvar pipe = require('bigpipe').createServer(2000, {\n  pagelets: [ bootstrap, ... ]\n});\n```\n\n### API\n\nThe following methods are available on the bootstrap instance. Most are\nonly used internally. There is rarely a reason to call these methods.\n\n#### new Bootstrap()\n\n**public**, _returns Pagelet_.\n\nThe bootstrap constructor expects several options to be provided, these\ninclude: `queue`, `mode`, `req`, `res` and `pipe`. The last option is\na reference to the BigPipe instance, mainly to ensure the same [Temper]\ninstance is re-used. All code examples assume your file is setup as:\n\n```js\n'use strict';\n\nvar Bootstrap = require('bootstrap-pagelet');\n  , bootstrap = new Bootstrap({ options });\n```\n\n#### Bootstrap.render()\n\n**public**, _returns string_.\n\nGenerates the HTML from the values on the pagelet. The properties\nin `bootstrap.keys` are provided to the template parser.\n\n```js\nvar html = bootstrap.render();\n```\n\n#### Bootstrap.queue()\n\n**private**, _returns Pagelet_.\n\nPush a chunk of HTML on the queue to be flushed. This function will\nalso decrease the internal counter of the number of flushed pagelets.\nBy default the counter is decreased with 1, but a specific _Number_\ncan be provided as well.\n\n```js\nbootstrap.queue('chunk of html', 2);\n```\n\n#### Bootstrap.flush()\n\n**private**, _returns Pagelet_.\n\nConcatenates all values in the `bootstrap._queue` and writes the Buffer\nwith the appropriate _charset_ to the response. This function has a\nfallback for older Node.JS versions to ensure `flush` is always emitted.\n\n```js\nvar emit = bootstrap.once('flush', function (error) {\n  // Result of the write to response.\n});\n\nbootstrap.flush();\n```\n\n## Debugging\n\nThe library makes use the `diagnostics` module from Pagelet.\nTo display the bootstrap Pagelet specific debug messages, supply the\nfollowing before running the program or\n\n```bash\nDEBUG=pagelet:bootstrap node ...\n```\n\n## Testing\n\nTests are automatically run on [Travis CI] to ensure that everything is\nfunctioning as intended. For local development we automatically install a\n[pre-commit] hook that runs the `npm test` command every time you commit changes.\nThis ensures that we don't push any broken code in to this project.\n\nTo run tests locally, make sure the development dependencies are installed.\n\n```bash\nnpm test\nnpm run coverage\n```\n\n## License\n\nBootstrap-pagelet is released under MIT.\n\n[Travis CI]: http://travisci.org\n[Temper]: http://github.com/bigpipe/temper\n[pre-commit]: http://github.com/observing/pre-commit\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbigpipe%2Fbootstrap-pagelet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbigpipe%2Fbootstrap-pagelet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbigpipe%2Fbootstrap-pagelet/lists"}