-
Notifications
You must be signed in to change notification settings - Fork 288
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Send experiment settings on initial page load (#1093)
- Loading branch information
1 parent
4ce8096
commit 8efc807
Showing
7 changed files
with
50 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,35 @@ | ||
import {Injectable} from '@angular/core'; | ||
|
||
interface ExperimentSettings { | ||
readonly websocketsEnabled: boolean; | ||
readonly concurrentUpdatesEnabled: boolean; | ||
readonly experimentalEditorToolbarEnabled: boolean; | ||
} | ||
|
||
@Injectable({ | ||
providedIn: 'root', | ||
}) | ||
export class ExperimentService { | ||
concurrentUpdatesEnabled = false; | ||
experimentalEditorToolbarEnabled = false; | ||
websocketsEnabled = false; | ||
private readonly settings: ExperimentSettings; | ||
|
||
constructor() { | ||
const windowSettings = (window as any).__MESOP_EXPERIMENTS__; | ||
this.settings = windowSettings ?? { | ||
websocketsEnabled: false, | ||
concurrentUpdatesEnabled: false, | ||
experimentalEditorToolbarEnabled: false, | ||
}; | ||
} | ||
|
||
get websocketsEnabled(): boolean { | ||
return this.settings.websocketsEnabled; | ||
} | ||
|
||
get concurrentUpdatesEnabled(): boolean { | ||
return this.settings.concurrentUpdatesEnabled; | ||
} | ||
|
||
get experimentalEditorToolbarEnabled(): boolean { | ||
return this.settings.experimentalEditorToolbarEnabled; | ||
} | ||
} |