ngx-indexed-db 开源项目教程

ngx-indexed-db 开源项目教程

ngx-indexed-dbA service that wraps IndexedDB database in an Angular service. It exposes very simple observables API to enable the usage of IndexedDB without most of it plumbing.项目地址:https://gitcode.com/gh_mirrors/ng/ngx-indexed-db

1. 项目的目录结构及介绍

ngx-indexed-db 项目的目录结构如下:

ngx-indexed-db/
├── src/
│   ├── lib/
│   │   ├── ngx-indexed-db.module.ts
│   │   ├── ngx-indexed-db.service.ts
│   │   ├── ...
│   ├── demo/
│   │   ├── app/
│   │   │   ├── app.component.ts
│   │   │   ├── app.module.ts
│   │   │   ├── ...
│   │   ├── assets/
│   │   ├── environments/
│   │   ├── index.html
│   │   ├── main.ts
│   │   ├── ...
│   ├── index.ts
│   ├── public-api.ts
├── package.json
├── tsconfig.json
├── ...

目录结构介绍

  • src/lib/:包含项目的主要代码,如 ngx-indexed-db.module.tsngx-indexed-db.service.ts
  • src/demo/:包含项目的演示代码,如 app.component.tsapp.module.ts
  • package.json:项目的依赖管理文件。
  • tsconfig.json:TypeScript 配置文件。

2. 项目的启动文件介绍

项目的启动文件位于 src/demo/main.ts,其主要作用是引导 Angular 应用的启动。

import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

import { AppModule } from './app/app.module';
import { environment } from './environments/environment';

if (environment.production) {
  enableProdMode();
}

platformBrowserDynamic().bootstrapModule(AppModule)
  .catch(err => console.error(err));

启动文件介绍

  • enableProdMode():启用生产模式。
  • platformBrowserDynamic().bootstrapModule(AppModule):引导 AppModule 模块启动应用。

3. 项目的配置文件介绍

项目的配置文件主要包括 tsconfig.jsonpackage.json

tsconfig.json

tsconfig.json 文件用于配置 TypeScript 编译选项。

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "downlevelIteration": true,
    "experimentalDecorators": true,
    "module": "esnext",
    "moduleResolution": "node",
    "importHelpers": true,
    "target": "es2015",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2018",
      "dom"
    ]
  }
}

package.json

package.json 文件用于管理项目的依赖和脚本。

{
  "name": "ngx-indexed-db",
  "version": "5.0.0",
  "description": "An angular wrapper for IndexedDB",
  "author": "Charles Assunção",
  "repository": {
    "type": "git",
    "url": "https://github.com/assuncaocharles/ngx-indexed-db.git"
  },
  "keywords": [
    "angular",
    "indexeddb",
    "store",
    "localstorage",
    "typescript"
  ],
  "license": "MIT",
  "bugs": {
    "url": "https://github.com/assuncaocharles/ngx-indexed-db/issues"
  },
  "homepage": "https://github.com/assuncaocharles/ngx-indexed-db#readme",
  "peerDependencies": {
    "@angular/common": "^12.0.0",
    "@angular/core": "^12.0.0"
  },
  "dependencies": {
    "

ngx-indexed-dbA service that wraps IndexedDB database in an Angular service. It exposes very simple observables API to enable the usage of IndexedDB without most of it plumbing.项目地址:https://gitcode.com/gh_mirrors/ng/ngx-indexed-db

  • 16
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

孙诗嘉Song-Thrush

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值