2

I have a chrome extension that does spell check. I want to implement the feature to 'add a word to dictionary' but I read that chrome extension api does not allow reading and writing to disk.

currently my dictionary is an array of strings:

var dictionary = ["google", "apache", "microsoft"];

My question is this: How should I properly store my dictionary? And how can I change its content during run time for the 'add to dictionary feature'?

4

2 に答える 2

7

Josh が述べたように、chrome storage API を使用します。たとえば、chrome.storage.sync.set()chrome.storage.sync.get()は、ユーザーが使用するさまざまなデバイス間で保存されたデータを自動的に同期します。これは、開発者とユーザーの両方にとって非常に便利です。

http://developer.chrome.com/extensions/storage.html

于 2013-09-02T21:16:35.183 に答える
1

ブラウザのローカルストレージを使用できます。ただし、本当に柔軟にしたい場合は、nodejs とソケットを使用できます。それが私の拡張機能の作成方法です。ノードアプリと通信するために、ユーザーのディスクとソケットにアクセスできるnodejsを使用しました。唯一の問題は、ユーザーがモジュールをインストールする必要があることです。

于 2013-09-02T20:55:36.437 に答える