Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ng-util/lazy
Project transferred to https://github.com/ng-util/ng-util/blob/master/packages/lazy/README.md
https://github.com/ng-util/lazy
angular angular-utility
Last synced: about 2 months ago
JSON representation
Project transferred to https://github.com/ng-util/ng-util/blob/master/packages/lazy/README.md
- Host: GitHub
- URL: https://github.com/ng-util/lazy
- Owner: ng-util
- License: mit
- Archived: true
- Created: 2018-12-14T08:17:12.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-01-29T13:18:21.000Z (over 5 years ago)
- Last Synced: 2024-07-06T10:01:27.777Z (3 months ago)
- Topics: angular, angular-utility
- Language: TypeScript
- Homepage:
- Size: 228 KB
- Stars: 11
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# nu-lazy
---Lazy load resources for Angular
[![NPM version](https://img.shields.io/npm/v/nu-lazy.svg?style=flat-square)](https://www.npmjs.com/package/nu-lazy)
[![Build Status](https://img.shields.io/travis/ng-util/lazy/master.svg?style=flat-square)](https://travis-ci.org/ng-util/lazy)
[![Codecov](https://img.shields.io/codecov/c/github/ng-util/lazy.svg?style=flat-square)](https://codecov.io/gh/ng-util/lazy)## Demo
- [Live Demo](https://cipchk.github.io/nu-lazy/)
- [Stackblitz](https://stackblitz.com/edit/nu-lazy)## Install
[![nu-lazy](https://nodei.co/npm/nu-lazy.png)](https://npmjs.org/package/nu-lazy)
## Usage
```typescript
import { LazyService } from 'nu-lazy';export class AppComponent {
constructor(private srv: LazyService) { }async loadBS() {
const res = await this.srv.load(`https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css`);
console.log(`bootstrap`, res);
}
```## How to use it with:
+ `Stackblitz` sample available [here](https://stackblitz.com/edit/nu-lazy).
## API
| name | type | description |
| ---- | -- | ----------- |
| `events` | `Observable` | Events change callback |
| `clear()` | `void` | Clean all cached items |
| `load(paths: string | string[])` | `Promise` | Load the specified resources, includes `.js`, `.css` |
| `loadScript(path: string)` | `Promise` | Load a script resources |
| `loadStyle(path: string)` | `Promise` | Load a style resources |## License
nu-lazy is released under the MIT license.