0.16.0 • Published 3 months ago
@tinijs/toolbox v0.16.0
TiniJS Toolbox
Useful services, helpers, ... for using in TiniJS apps.
Install
To install the module: npm i @tinijs/toolbox
It is recommended to download the Skeleton for a ready-to-use structured project.
For more, please visit: https://tinijs.dev (TODO)
Usage
- Create the
providers.ts
import {DependencyProviders} from '@tinijs/core';
export default {
fetchService: () => import('@tinijs/toolbox/fetch/service'),
} as DependencyProviders;
- Register the providers in
app.ts
import providers from './providers';
@App({providers})
export class AppRoot extends TiniComponent {}
- Inject & use the dependency
import {Inject} from '@tinijs/core';
import {FetchService} from '@tinijs/toolbox';
@Page({
name: 'app-page-home',
})
export class AppPageHome extends TiniComponent {
@Inject() fetchService!: FetchService;
async onInit() {
const data = await this.fetchService.get('https://jsonplaceholder.typicode.com/todos/1')
}
}
API
// TODO
Developement
- Create a home for TiniJS:
mkdir TiniJS && cd TiniJS
- Fork the repo
- Install dependencies:
cd toolbox && npm i
- Make changes & preview locally:
npm run build && npm pack
- Push changes & create a PR 👌
License
@tinijs/toolbox is released under the MIT license.