{"id":24289257,"url":"https://github.com/rla/kontainer","last_synced_at":"2025-03-06T01:22:11.568Z","repository":{"id":29870709,"uuid":"33415882","full_name":"rla/kontainer","owner":"rla","description":"ViewModel lifecycle manager KnockoutJS applications","archived":false,"fork":false,"pushed_at":"2015-04-14T23:22:52.000Z","size":144,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-17T02:47:53.337Z","etag":null,"topics":["frontend","knockoutjs"],"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/rla.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":"2015-04-04T18:38:09.000Z","updated_at":"2019-08-18T16:42:13.000Z","dependencies_parsed_at":"2022-09-07T00:40:56.938Z","dependency_job_id":null,"html_url":"https://github.com/rla/kontainer","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/rla%2Fkontainer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rla%2Fkontainer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rla%2Fkontainer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rla%2Fkontainer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rla","download_url":"https://codeload.github.com/rla/kontainer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242128906,"owners_count":20076276,"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":["frontend","knockoutjs"],"created_at":"2025-01-16T10:51:44.461Z","updated_at":"2025-03-06T01:22:11.542Z","avatar_url":"https://github.com/rla.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# kontainer\n\nViewModel lifecycle manager for (parts of) KnockoutJS applications. Offers more flexibility\nthan built-in KO components and prevents unnecessary reflows.\n\n## API\n\n    var show = kontainer.create(Element|String target)\n\nReturns function to replace the contents of the given target element.\nThe target element can be given as a DOM element or a selector expression.\n\n    show(DOM|String template, Object viewModel)\n\nBinds and renders the template to the previously set target. Template\ncan be either a DOM element/document fragment or a string. Unbinds\npreviously set viewModel.\n\n### Lifecycle callbacks\n\nThe viewModel can have the following methods defined:\n\n * `inserted(DOM target)` - called when the template is inserted into the DOM tree.\n * `bound(DOM target)` - called when the viewModel is bound to the DOM tree.\n * `dispose(DOM target)` - called when the template and the viewModel are replaced.\n\nThe `inserted` callback is called before `bound` as the template is\ninserted into the DOM tree before the bindings are applied.\n\n## Example\n\n```javascript\nvar show = kontainer.create('#content');\ndocument.getElementById('link-page-1').addEventListener('click', function() {\n    show('\u003cspan data-bind=\"text: message\"\u003e\u003c/span\u003e',\n        { message: ko.observable('Hello World!') });\n}, false);\n```\n\nCreates target on element with id `content` and sets up a link handler to replace its\ncontents with the given template and view model.\n\n## AMD/CommonJS\n\nThe source `kontainer.js` uses CommonJS module format. `dist/kontainer-standalone.js`\ncontains minified build in UMD format that supports both AMD and CommonJS environments and also\nsets global `kontainer`.\n\nIf installed through NPM then the module can be directly used in browserify by simply require()'ing\nit:\n\n    var kontainer = require('kontainer');\n\n## Building/testing\n\nInstall build dependencies:\n\n    npm install\n\nRun static server:\n\n    make serve-test\n\nRun tests:\n\n    make test\n\n## License\n\nThe MIT License.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frla%2Fkontainer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frla%2Fkontainer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frla%2Fkontainer/lists"}