angular-local-storage icon indicating copy to clipboard operation
angular-local-storage copied to clipboard

Add support for Chrome Web Apps

Open sondreb opened this issue 8 years ago • 6 comments

Would it be possible to add support for Chrome Web Apps? So that the library can be used across different platforms, and if the code runs within a Chrome Web App, it would use chrome.storage.local and not window.localStorage.

sondreb avatar Oct 10 '15 19:10 sondreb

I think it would. It's just another storage type.

grevory avatar Oct 13 '15 17:10 grevory

@grevory You accepting PR's for this?

richarddavenport avatar Dec 14 '15 22:12 richarddavenport

@richarddavenport feel free to open a PR. Any suggestion on how to tackle this?

ealves-pt avatar Feb 18 '16 00:02 ealves-pt

@ealves-pt and @grevory, one thing I'm seeing (finally looking at this) is that localStorage and sessionStorage return values immediately, which makes things pretty easy to work with. However, when using chrome.storage they return a callback. I think that having callbacks are good, but I could see how it might break some things. I think that if the code was refactored slightly it would make things more extendable and open up the possibility to use other storage use cases down the road. Right now I think adding chrome.storage would add some bloat, but refactoring could keep the code to a manageable size.

Let me know if you guys are willing to look at some of the code.

richarddavenport avatar May 14 '16 19:05 richarddavenport

I've written a number of Chrome extensions so I do have interest in this. On May 14, 2016 5:22 PM, "Richard Davenport" [email protected] wrote:

@ealves-pt https://github.com/ealves-pt and @grevory https://github.com/grevory, one thing I'm seeing (finally looking at this) is that localStorage and sessionStorage return values immediately, which makes things pretty easy to work with. However, when using chrome.storage they return a callback. I think that having callbacks are good, but I could see how it might break some things. I think that if the code was refactored slightly it would make things more extendable and open up the possibility to use other storage use cases down the road. Right now I think adding chrome.storage would add some bloat, but refactoring could keep the code to a manageable size.

Let me know if you guys are willing to look at some of the code.

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/grevory/angular-local-storage/issues/257#issuecomment-219247766

grevory avatar May 15 '16 14:05 grevory

I've seen a couple of different suggestions for changing the api, but of course they may be breaking changes. localStorageService.set(key, value, storageType)); and localStorageService.setStorageType(storageType).set(key, value)); Both of these might be possible as optional and be implemented as non-breaking changes, but I'm not 100% sure.

richarddavenport avatar May 15 '16 19:05 richarddavenport