Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

curious why `Drivers` is `@hidden` and can it be made iterable?

オープン
#228 コメント 0 件 リアクション 3 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
32/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
angular, sqlite, typescript
領域
api, databases

調査の方向性

lib/src/index.tsから始め、特にDriversのexportとdriverOrderに関するコメントを確認してから、リポジトリのドキュメントにあるAngularの例と比較します。Driversの意図された公開ステータスと、反復可能なドライバーの順序付けが要求されたAPIの一部であるかどうかを判断します。動作と推奨される使用方法が明確に決定され、文書化されていれば完了です。

索引モデルが issue の本文から書いたものです。

説明

OK so I'm just returning to some Angular stuff after about a year off and seems like I've arrived just as there are breaking changes required on the storage.

I'm working through the documentation and trying to distill the best practices out of it.

I'm adding in the sqlite support.

Driver Order

Firstly I got stuck a bit reading through the source code to make sure what the correct order of the drivers should be.

I'm aiming to use the sqllite driver, but it seems like it then puts the responsibility of taking control of all the other drivers as well. I didn't know which was the best order to put them in.

Reading through the code I've settled on this:

import { IonicStorageModule } from '@ionic/storage-angular';
import { Drivers } from '@ionic/storage';
import * as CordovaSQLiteDriver from 'localforage-cordovasqlitedriver';

@NgModule({
  // snip
  imports: [
    // snip
    IonicStorageModule.forRoot({
      driverOrder: [CordovaSQLiteDriver._driver, Drivers.IndexedDB, Drivers.LocalStorage]
    })  ],

Drivers Hidden

Which brings me to the second thing - why is the Drivers exported but @hidden (see here)?

This makes it feel like I shouldn't be using it, but I would prefer not to use strings in my list like the comments seem to hint at. It's also used in the example code in the docs.

Also the second code example only adds in one of them, which was confusing:

driverOrder: [CordovaSQLiteDriver._driver, Drivers.IndexedDB]

Drivers Iterable?

Finally, would it be possible / practical to make Drivers iterable? Instead of taking responsibility for getting the order right this time, and having to maintain that in the future, I thought I was being clever to try this:

driverOrder: [CordovaSQLiteDriver._driver, ...Drivers]

But the compiler politely declined that idea with:

Type '{ SecureStorage: string; IndexedDB: string; LocalStorage: string; }' must have a '[Symbol.iterator]()' method that returns an iterator.ts(2488)

主要言語
TypeScript
スター
456
フォーク
97
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ionic-team/ionic-storage のほかの issue

ionic-team/ionic-storage の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。