Last active
March 7, 2023 14:23
-
-
Save BrunoAlmeidaKotesky/56c29a2b547ffeda62741c0771df2aea to your computer and use it in GitHub Desktop.
Proposal state machine for sp-list-formatter
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
function createStateMachine<States extends string, TagIds extends string>( | |
events: { | |
for: [States, TagIds, FormatterOptions][], | |
transitions: Array<{ | |
from: States, | |
to: States, | |
when: { | |
operator: Operators, | |
operands: Operands | |
} | |
}> | |
} | |
) { | |
//Don't know how to implement that with ListFormatterBuilder yet. | |
for (const [state, tagId, config] of events.for) { | |
// ... ??? | |
} | |
} | |
const t = createStateMachine<"A" | "D", "div1">({ | |
for: [ | |
["A", "div1", {}], | |
["D", "div1", {}] | |
], | |
transitions: [{ | |
from: "A", | |
to: "D", | |
when: { | |
operator: "==", | |
operands: ["@currentField", "x"] | |
} | |
}] | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment