From 70b44cbd29e93a70d3014e00bd3a860ec442fc70 Mon Sep 17 00:00:00 2001 From: Raphael Forment Date: Sun, 22 Oct 2023 23:53:57 +0200 Subject: [PATCH] adding new doc page --- index.html | 1 + src/API.ts | 9 ++++++++- src/Documentation.ts | 2 ++ src/InterfaceLogic.ts | 1 + src/documentation/oscilloscope.ts | 8 ++++++++ 5 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 src/documentation/oscilloscope.ts diff --git a/index.html b/index.html index 1c161cd..1d47cc7 100644 --- a/index.html +++ b/index.html @@ -164,6 +164,7 @@

More

diff --git a/src/API.ts b/src/API.ts index 74521f4..d42333e 100644 --- a/src/API.ts +++ b/src/API.ts @@ -1976,11 +1976,18 @@ export class UserAPI { // ============================================================= // Oscilloscope Configuration // ============================================================= + public scope = (config: OscilloscopeConfig): void => { /** * Configures the oscilloscope. * @param config - The configuration object */ - this.app.osc = config; + // Dispatch the config to the old object so that missing options + // are still specified + + this.app.osc = { + ...this.app.osc, + ...config, + }; }; } diff --git a/src/Documentation.ts b/src/Documentation.ts index 114d9e3..a2dea88 100644 --- a/src/Documentation.ts +++ b/src/Documentation.ts @@ -1,5 +1,6 @@ import { type Editor } from "./main"; import { introduction } from "./documentation/introduction"; +import { oscilloscope } from "./documentation/oscilloscope"; import { samples } from "./documentation/samples"; import { chaining } from "./documentation/chaining"; import { software_interface } from "./documentation/interface"; @@ -85,6 +86,7 @@ export const documentation_factory = (application: Editor) => { functions: functions(application), reference: reference(), shortcuts: shortcuts(), + oscilloscope: oscilloscope(application), bonus: bonus(application), about: about(), }; diff --git a/src/InterfaceLogic.ts b/src/InterfaceLogic.ts index 867020b..85e2eac 100644 --- a/src/InterfaceLogic.ts +++ b/src/InterfaceLogic.ts @@ -451,6 +451,7 @@ export const installInterfaceLogic = (app: Editor) => { "shortcuts", "about", "bonus", + "oscilloscope", ].forEach((e) => { let name = `docs_` + e; document.getElementById(name)!.addEventListener("click", async () => { diff --git a/src/documentation/oscilloscope.ts b/src/documentation/oscilloscope.ts new file mode 100644 index 0000000..3b1dda6 --- /dev/null +++ b/src/documentation/oscilloscope.ts @@ -0,0 +1,8 @@ +import { type Editor } from "../main"; +import { makeExampleFactory } from "../Documentation"; + +export const oscilloscope = (application: Editor): string => { + const makeExample = makeExampleFactory(application); + return `# Oscilloscope + `; +};