Re: chrome.storage.onChanged ?

2,216 views
Skip to first unread message

kalman

unread,
Oct 4, 2012, 2:30:33 AM10/4/12
to chromium-...@chromium.org
Could you give more detail into how you're testing it? A reduced test case perhaps?

I would ask questions like "are you sure the extensions have the same ID" (might not happen if they're installed unpacked) and "are you sure you're syncing across the same account", but if you can set in one place and get in another, it would imply that the answer to those questions is "yes".


On Thursday, October 4, 2012 9:39:33 AM UTC+10, johnjbarton wrote:
Has anyone had luck with chrome.storage.onChanged listeners?
I can set/get values to chrome.storage.sync, but only rarely do I see a result in chrome.storage.onChanged and then only on the same browser I use chrome.storage.set(). 

jjb

John J Barton

unread,
Oct 4, 2012, 10:54:33 AM10/4/12
to kalman, chromium-...@chromium.org
On Wed, Oct 3, 2012 at 11:30 PM, kalman <kal...@chromium.org> wrote:
> Could you give more detail into how you're testing it?

https://github.com/johnjbarton/devtoolsExtended/blob/atopwi/extension/background.js#L66

> A reduced test case
> perhaps?

I was hoping that someone would provide an example showing that it
works. The developer site examples do not seem to include onChange.

Is there even a simple sync example? All I see is stylizer example,
but it does not use chrome.storage.sync.

>
> I would ask questions like "are you sure the extensions have the same ID"
> (might not happen if they're installed unpacked) and "are you sure you're
> syncing across the same account", but if you can set in one place and get in
> another, it would imply that the answer to those questions is "yes".

I (always) use a defined key in the manifest. My login is correct
because set/get do sync correctly.

Thanks,
jjb

>
>
>
> On Thursday, October 4, 2012 9:39:33 AM UTC+10, johnjbarton wrote:
>>
>> Has anyone had luck with chrome.storage.onChanged listeners?
>> I can set/get values to chrome.storage.sync, but only rarely do I see a
>> result in chrome.storage.onChanged and then only on the same browser I use
>> chrome.storage.set().
>>
>> jjb
>
> --
> You received this message because you are subscribed to the Google Groups
> "Chromium-extensions" group.
> To view this discussion on the web visit
> https://groups.google.com/a/chromium.org/d/msg/chromium-extensions/-/-HxL300EYkcJ.
>
> To post to this group, send email to chromium-...@chromium.org.
> To unsubscribe from this group, send email to
> chromium-extens...@chromium.org.
> For more options, visit this group at
> http://groups.google.com/a/chromium.org/group/chromium-extensions/?hl=en.

kalman

unread,
Oct 5, 2012, 12:18:02 AM10/5/12
to chromium-...@chromium.org, kalman

John J Barton

unread,
Oct 5, 2012, 11:42:51 AM10/5/12
to kalman, chromium-...@chromium.org
On Thu, Oct 4, 2012 at 9:18 PM, kalman <kal...@chromium.org> wrote:
> There is an example here:
> http://developer.chrome.com/extensions/storage.html#examples

If you look at the link I posted you will see that I copied my code
from the page you link above. It does not work.

I was hoping for a sample extension like these:
http://developer.chrome.com/extensions/samples.html

jjb
>> > chromium-extens...@chromium.org.
>> > For more options, visit this group at
>> >
>> > http://groups.google.com/a/chromium.org/group/chromium-extensions/?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Chromium-extensions" group.
> To view this discussion on the web visit
> https://groups.google.com/a/chromium.org/d/msg/chromium-extensions/-/E7-6QcjujJEJ.
>
> To post to this group, send email to chromium-...@chromium.org.
> To unsubscribe from this group, send email to
> chromium-extens...@chromium.org.

John J Barton

unread,
Oct 5, 2012, 12:38:04 PM10/5/12
to kalman, chromium-...@chromium.org
On Fri, Oct 5, 2012 at 8:42 AM, John J Barton
<johnj...@johnjbarton.com> wrote:
> On Thu, Oct 4, 2012 at 9:18 PM, kalman <kal...@chromium.org> wrote:
>> There is an example here:
>> http://developer.chrome.com/extensions/storage.html#examples
>
> If you look at the link I posted you will see that I copied my code
> from the page you link above. It does not work.
>
> I was hoping for a sample extension like these:
> http://developer.chrome.com/extensions/samples.html

I created one:
http://code.google.com/p/chromium/issues/detail?id=154315

This example works for me so now I will compare it to my app.

jjb

Mihai Parparita

unread,
Oct 5, 2012, 12:38:32 PM10/5/12
to John J Barton, kalman, chromium-...@chromium.org
FWIW, I've used the storage API with change events (https://github.com/mihaip/clipboard-sync) and it's worked just fine for me.

Mihai

On Fri, Oct 5, 2012 at 8:42 AM, John J Barton <johnj...@johnjbarton.com> wrote:

Scott Fujan

unread,
Oct 5, 2012, 12:44:46 PM10/5/12
to Mihai Parparita, John J Barton, kalman, chromium-...@chromium.org
If this is just about sync not syncing, try uploading a test extension to the webstore. Unpacked apps have never synced for me, but after being uploaded they synced just fine. I imagine externally hosted packed apps would work as well, but I'm not sure.

Mihai Parparita

unread,
Oct 5, 2012, 1:31:19 PM10/5/12
to Scott Fujan, John J Barton, kalman, chromium-...@chromium.org
Unpacked apps synced for me, but I had to make sure they got the same extension ID in all locations they were loaded (either by having the same path, or by using a "key" field in the manifest to force their ID to be deterministic).

Mihai
Reply all
Reply to author
Forward
0 new messages