Add typing to playground.ts.
This commit is contained in:
parent
859717e482
commit
99cef8f26d
|
@ -105,7 +105,7 @@ async function onLoad() {
|
||||||
window.pageContent = document.querySelector("#pageContent");
|
window.pageContent = document.querySelector("#pageContent");
|
||||||
|
|
||||||
if (process.env.NODE_ENV == "development") {
|
if (process.env.NODE_ENV == "development") {
|
||||||
await (await import("./playground.js")).playground();
|
await (await import("./playground.ts")).playground();
|
||||||
}
|
}
|
||||||
|
|
||||||
renderPage();
|
renderPage();
|
||||||
|
|
|
@ -45,7 +45,7 @@ export async function prePageChecks(): Promise<boolean> {
|
||||||
|
|
||||||
|
|
||||||
export function addClipboardNotifications(clipboard: ClipboardJS, timeout = 1000): void {
|
export function addClipboardNotifications(clipboard: ClipboardJS, timeout = 1000): void {
|
||||||
clipboard.on('success', _ => {
|
clipboard.on('success', () => {
|
||||||
(UIkit as any).notification(i18next.t("notification_copy_success"), {
|
(UIkit as any).notification(i18next.t("notification_copy_success"), {
|
||||||
status: 'success',
|
status: 'success',
|
||||||
timeout: timeout
|
timeout: timeout
|
||||||
|
@ -116,7 +116,7 @@ export function setTitleElement(pageState: PageState): void {
|
||||||
makeElement({
|
makeElement({
|
||||||
tag: "a",
|
tag: "a",
|
||||||
text: pageState.currentBaseMount + " ",
|
text: pageState.currentBaseMount + " ",
|
||||||
onclick: _ => {
|
onclick: () => {
|
||||||
pageState.currentSecretPath = [];
|
pageState.currentSecretPath = [];
|
||||||
pageState.currentSecret = "";
|
pageState.currentSecret = "";
|
||||||
pageState.currentSecretVersion = null;
|
pageState.currentSecretVersion = null;
|
||||||
|
@ -134,7 +134,7 @@ export function setTitleElement(pageState: PageState): void {
|
||||||
return makeElement({
|
return makeElement({
|
||||||
tag: "a",
|
tag: "a",
|
||||||
text: secretPath + " ",
|
text: secretPath + " ",
|
||||||
onclick: _ => {
|
onclick: () => {
|
||||||
pageState.currentSecretVersion = null;
|
pageState.currentSecretVersion = null;
|
||||||
if (pageState.currentMountType.startsWith("kv")) {
|
if (pageState.currentMountType.startsWith("kv")) {
|
||||||
pageState.currentSecretPath = secretPaths.slice(0, index + 1);
|
pageState.currentSecretPath = secretPaths.slice(0, index + 1);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { pageState } from "./globalPageState.ts";
|
import { pageState } from "./globalPageState";
|
||||||
import i18next from 'i18next';
|
import i18next from 'i18next';
|
||||||
|
|
||||||
// Playground is a way to debug and test things.
|
// Playground is a way to debug and test things.
|
||||||
|
@ -7,8 +7,8 @@ import i18next from 'i18next';
|
||||||
// Also it only runs when process.env.NODE_ENV == "development"
|
// Also it only runs when process.env.NODE_ENV == "development"
|
||||||
|
|
||||||
// Please empty this function before committing.
|
// Please empty this function before committing.
|
||||||
export async function playground() {
|
export async function playground(): Promise<void> {
|
||||||
console.log("Welcome to Playground!");
|
console.log("Welcome to Playground!");
|
||||||
window.pageState = pageState;
|
(window as any).pageState = pageState;
|
||||||
window.i18next = i18next;
|
(window as any).i18next = i18next;
|
||||||
}
|
}
|
|
@ -1,7 +1,8 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "./dist/",
|
"outDir": "./dist/",
|
||||||
"noImplicitAny": true,
|
"noImplicitAny": false,
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
"module": "es6",
|
"module": "es6",
|
||||||
"target": "es5",
|
"target": "es5",
|
||||||
"jsx": "react",
|
"jsx": "react",
|
||||||
|
|
Loading…
Reference in a new issue