{"id":13805387,"url":"https://github.com/buschtoens/ember-lazy-mount","last_synced_at":"2025-04-14T03:13:02.593Z","repository":{"id":27074513,"uuid":"112352621","full_name":"buschtoens/ember-lazy-mount","owner":"buschtoens","description":"{{mount}} lazy loading route-less engines","archived":false,"fork":false,"pushed_at":"2024-10-02T22:03:03.000Z","size":3435,"stargazers_count":12,"open_issues_count":9,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-14T03:12:53.959Z","etag":null,"topics":["ember","ember-addon","ember-engines","emberjs"],"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/buschtoens.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","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-11-28T15:23:58.000Z","updated_at":"2024-07-10T01:25:55.000Z","dependencies_parsed_at":"2024-01-02T21:22:19.825Z","dependency_job_id":"ff584811-1e23-4fad-8cec-24355fb43ed3","html_url":"https://github.com/buschtoens/ember-lazy-mount","commit_stats":{"total_commits":555,"total_committers":7,"mean_commits":79.28571428571429,"dds":0.2900900900900901,"last_synced_commit":"000ab0d249c0addecb03e165fea0023e1a74f091"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buschtoens%2Fember-lazy-mount","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buschtoens%2Fember-lazy-mount/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buschtoens%2Fember-lazy-mount/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buschtoens%2Fember-lazy-mount/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/buschtoens","download_url":"https://codeload.github.com/buschtoens/ember-lazy-mount/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248813801,"owners_count":21165634,"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":["ember","ember-addon","ember-engines","emberjs"],"created_at":"2024-08-04T01:01:00.651Z","updated_at":"2025-04-14T03:13:02.547Z","avatar_url":"https://github.com/buschtoens.png","language":"JavaScript","funding_links":[],"categories":["Packages"],"sub_categories":["Code Splitting"],"readme":"# ember-lazy-mount\n\n[![CI](https://github.com/buschtoens/ember-lazy-mount/workflows/CI/badge.svg)](https://github.com/buschtoens/ember-lazy-mount/actions)\n[![npm version](https://badge.fury.io/js/ember-lazy-mount.svg)](http://badge.fury.io/js/ember-lazy-mount)\n[![Download Total](https://img.shields.io/npm/dt/ember-lazy-mount.svg)](http://badge.fury.io/js/ember-lazy-mount)\n[![Ember Observer Score](https://emberobserver.com/badges/ember-lazy-mount.svg)](https://emberobserver.com/addons/ember-lazy-mount)\n[![Ember Versions](https://img.shields.io/badge/Ember.js%20Versions-%5E4.12-brightgreen.svg)](https://github.com/buschtoens/ember-lazy-mount/actions)\n[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)  \n[![Dependabot enabled](https://img.shields.io/badge/dependabot-enabled-blue.svg?logo=dependabot)](https://dependabot.com/)\n[![Dependencies](https://img.shields.io/librariesio/github/buschtoens/ember-lazy-mount)](https://libraries.io/github/buschtoens/ember-lazy-mount)\n\n`{{mount}}` lazy loading route-less engines.\n\n## Compatibility\n\n- Ember.js v4.12 or above\n- Embroider or ember-auto-import v2\n\n## Installation\n\n```\nember install ember-lazy-mount\n```\n\n## Usage\n\n### `{{lazy-mount}}` Component\n\n- **`name`**: _`string`_ — The name of the engine to load\n- **`model?`**: _`any`_ — Optional model that will be passed through to the engine\n\nThe `{{lazy-mount}}` component works just like the [`{{mount}}` helper](https://emberjs.com/api/ember/3.5/classes/Ember.Templates.helpers/methods/mount?anchor=mount).\nIt accepts the name of the engine as a positional parameter and also an optional\n`model` parameter.\n\nAs soon as the helper is rendered, it will begin loading the specified engine.\nIf the engine is already loaded, it will be mounted immediately.\n\nThe `engineName` and `model` parameters are dynamic and you can update them.\nSetting a new `engineName` will cause the new engine to be loaded and mounted.\n\n#### Inline Usage\n\nWhile the engine is loading, nothing is rendered. If there was an error loading\nthe engine, nothing is rendered.\n\n```hbs\n{{lazy-mount engineName model=optionalDataForTheEngine}}\n```\n\nYou can also pass three optional hooks:\n\n```hbs\n{{lazy-mount\n  this.engineName\n  onLoad=this.onLoad\n  didLoad=this.didLoad\n  onError=this.onError\n}}\n```\n\n- **`onLoad()`** — Called when the engine starts loading\n- **`didLoad()`** — Called when the engine loaded successfully\n- **`onError(error: Error)`** — Called when the engine failed to load\n\n#### Block Usage\n\nWhile the engine is loading or if there was an error loading the engine, the\nblock that is passed to the component is rendered. The `engine` block parameter\nis an object with two properties:\n\n- **`isLoading`**: _`boolean`_ — Whether or not the engine is currently loading\n- **`error`**: _`Error | null`_ — If there was an error loading the engine\n\nWhen the engine was loaded successfully, the passed in block is replaced by the\nengine.\n\n```hbs\n{{#lazy-mount engineName model=optionalDataForTheEngine as |engine|}}\n  {{#if engine.isLoading}}\n    🕑 The engine is loading...\n  {{else if engine.error}}\n    😨 There was an error loading the engine:\n    \u003ccode\u003e{{engine.error}}\u003c/code\u003e\n  {{/if}}\n{{/lazy-mount}}\n```\n\nYou can also pass in the same hooks: `onLoad`, `didLoad`, `onError`\n\n## Contributing\n\nSee the [Contributing](CONTRIBUTING.md) guide for details.\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbuschtoens%2Fember-lazy-mount","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbuschtoens%2Fember-lazy-mount","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbuschtoens%2Fember-lazy-mount/lists"}