Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Bug 1201481 - Let AppTextSelectionDialogs from all opened apps share one single pref. observer in shared global states. #31697

Merged
merged 3 commits into from Sep 8, 2015

Conversation

chenpighead
Copy link
Contributor

SettingsListener.observe is moved into shared global states. I use an AppTextSelectionDialog array in global states to keep all AppTextSelectionDialog instances from launched apps. The state of each AppTextSelectionDialog would be updated whenever copypaste.enable pref is changed.

@mozilla-autolander-deprecated
Copy link
Contributor

@@ -9,6 +9,11 @@
// states which are shared by apps should be put in this class.
var AppTextSelectionDialogGlobalStates = function() {
this._hasCutOrCopiedTimeoutId = null;
this._isPrefOn = true;
this._appTSDArray = [];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am very sorry for giving you the wrong information, but this should be updated with a Set()

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, this._appTSDs = new Set();

…one single pref. observer in shared global states. (v2)
@mozilla-autolander-deprecated
Copy link
Contributor

@@ -9,6 +9,11 @@
// states which are shared by apps should be put in this class.
var AppTextSelectionDialogGlobalStates = function() {
this._hasCutOrCopiedTimeoutId = null;
this._isPrefOn = true;
this._appTSDs = new Set();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One little small change (sorry): s/_appTSDs/appTSDs/g since we intend to allow external access of the set.

@mozilla-autolander-deprecated
Copy link
Contributor

lissyx added a commit that referenced this pull request Sep 8, 2015
Bug 1201481 - Let AppTextSelectionDialogs from all opened apps share one single pref. observer in shared global states.
@lissyx lissyx merged commit 641d403 into mozilla-b2g:master Sep 8, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
4 participants