mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-08-29 10:09:26 +02:00
editor: disable the profiler by default
This commit is contained in:
@@ -197,10 +197,9 @@ export function installProfilerGlobals() {
|
||||
};
|
||||
|
||||
(globalThis as unknown as Record<string, unknown>).editorProfiler = api;
|
||||
console.log(
|
||||
profiler.enabled
|
||||
? "[profiler] on by default. window.editorProfiler.print() for a report, .disable() to turn off."
|
||||
: "[profiler] off. window.editorProfiler.enable() to turn it back on."
|
||||
);
|
||||
if (profiler.enabled)
|
||||
console.log(
|
||||
"[profiler] active. window.editorProfiler.print() for a report, .disable() to turn off."
|
||||
);
|
||||
return api;
|
||||
}
|
||||
|
||||
@@ -29,15 +29,15 @@ beforeEach(() => {
|
||||
});
|
||||
|
||||
describe("profiler", () => {
|
||||
test("is enabled by default", () => {
|
||||
test("is disabled by default", () => {
|
||||
globalThis.localStorage?.clear();
|
||||
expect(new Profiler().enabled).toBe(true);
|
||||
expect(new Profiler().enabled).toBe(false);
|
||||
});
|
||||
|
||||
test("stays disabled across reloads once turned off", () => {
|
||||
test("stays enabled across reloads once turned on", () => {
|
||||
globalThis.localStorage?.clear();
|
||||
new Profiler().disable();
|
||||
expect(new Profiler().enabled).toBe(false);
|
||||
new Profiler().enable();
|
||||
expect(new Profiler().enabled).toBe(true);
|
||||
});
|
||||
|
||||
test("records nothing while disabled", () => {
|
||||
|
||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
const STORAGE_KEY = "nn:profiler";
|
||||
const DEFAULT_ENABLED = true;
|
||||
const DEFAULT_ENABLED = false;
|
||||
const DEFAULT_MAX_SAMPLES = 4000;
|
||||
const DEFAULT_MAX_TIMELINE = 4000;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user