Implement GM_watchValue/GM_unwatchValue #24

Closed
supahgreg opened this Issue Sep 23, 2012 · 5 comments

Projects

None yet

2 participants

@supahgreg supahgreg was assigned Sep 23, 2012
@supahgreg supahgreg added a commit that closed this issue Sep 23, 2012
@supahgreg supahgreg Implementing GM_watchValue and GM_unwatchValue. Closes #24
(cherry picked from commit 4d3e46e)
22fbde1
@supahgreg supahgreg closed this in 22fbde1 Sep 23, 2012
@dindog
dindog commented Sep 24, 2012

In console, the log message show like this:
[10:47:58.891] [test@dindog] removed 'foo' observer #1 @ resource://scriptish/utils/Scriptish_injectScripts.js:86

Other log show the exact line of the userscript instead of scriptish internal file, can you improve that?
[10:48:01.363] [test@dindog] top window: load @ chrome://scriptish/content/scriptish.js -> file:///D:/fx%20profile/amy/scriptish_scripts/test@dindog/test@dindog.user.js:16

@dindog
dindog commented Sep 24, 2012

Also, I don't understand the log sequence, the listener removed message is log before the listener itself:

[11:09:11.436] [test@dindog] 'foo' observer #1 GUID == {5a091aec-d611-42db-8f31-12d7a7047c5f} 
[11:09:11.437] [test@dindog] 'foo' observer #2 GUID == {5a091aec-d611-42db-8f31-12d7a7047c5f} 
[11:09:11.437] [test@dindog] removed 'foo' observer #1 
[11:09:11.438] [test@dindog] removed all 'foo' observers 
[11:09:11.448] [test@dindog] #1 observed 'foo' changed from 'bar' to 'baz' 
[11:09:11.449] [test@dindog] #2 observed 'foo' changed from 'bar' to 'baz' 
[11:09:11.449] [test@dindog] #2 observed 'foo' changed from 'baz' to 'qux' 
@supahgreg

Your first comment is unrelated to this item, and seems to be a Web Console + GM_log thing. Using console.log should give the userscript file. If you want, create a separate issue.

There is a delay between Scriptish learning about the change and the userscript's "watcher" being notified. In that time other things can occur, like the relatively quick GM_unwatchValue. Things are still happening as expected, but don't seem that way in the sample userscript due to the logging... I'll probably add something better to the wiki later on.

@dindog
dindog commented Sep 24, 2012

Yes, you are right. GM_log() and console.log() is different.
#56

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment