![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@devtools-ds/console
Advanced tools
The `Console` component emulates the familiar JavaScript REPL experience seen in many browsers. You can customize the function that executes the code, as well as how results are displayed.
The Console
component emulates the familiar JavaScript REPL experience seen in many browsers. You can customize the function that executes the code, as well as how results are displayed.
npm i @devtools-ds/console
# or with yarn
yarn add @devtools-ds/console
Then to use the component in your code just import it!
import { Console } from "@devtools-ds/console";
Render the console, and pass a function to execute an expression.
The result of the execution will display using the ObjectInspector
.
<Console execute={() => {}} />
You can also customize how the results are displayed.
Provide a component with a result
property and it will be used instead.
In browsers, the console displays results using an ObjectInspector
.
This package exports a ConsoleResultInspector
component which mirrors that behavior using @devtools-ds/object-inspector
.
We don't set it as the default resultComponent
for performance reasons; that would cause @devtools-ds/object-inspector
to always be imported even if you don't use it.
import {
Console,
ConsoleExpression,
ConsoleResultInspector,
ConsoleResultProps,
} from "@devtools-ds/console";
/** A custom result component */
export const ConsoleResultCustom = ({ result }: ConsoleResultProps) => {
return <div>{result}</div>;
};
// Use the custom result component
<Console resultComponent={ConsoleResultCustom} />
// Use @devtools-ds/object-inspector
<Console resultComponent={ConsoleResultInspector} />
By default, the Console
component will automatically maintain state for you. If you'd like to control it yourself, you can provide your own history
.
const [history, setHistory] = React.useState<ConsoleExpression[]>([]);
return (
<Console
history={history}
execute={callback((expression: string) => {
const run: ConsoleExpression = {
id: history.length.toString(),
expression,
result: expression,
};
setHistory((oldHistory) => [...oldHistory, run]);
})}
/>
);
Thanks goes to these wonderful people (emoji key):
Adam Dierkens 💻 📖 🎨 | Tyler Krupicka 💻 📖 🎨 🚇 💡 ⚠️ | Andrew Lisowski 💻 |
This project follows the all-contributors specification. Contributions of any kind welcome!
FAQs
The `Console` component emulates the familiar JavaScript REPL experience seen in many browsers. You can customize the function that executes the code, as well as how results are displayed.
We found that @devtools-ds/console demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.