Starter template for parcel-cep-plugin, a zero configuration CEP extension builder for Parcel.
git clone https://github.com/fusepilot/parcel-plugin-cep-starter.git
cd parcel-plugin-cep-starter
yarn && yarn start
Open your CC app of choice, find your extension under Window
> Extensions
, and start developing.
To create a production build:
yarn build
To create a .zxp for deployment:
yarn zxp
A versioned .zxp file will be placed inside archive
.
- Add the function to the
$.global
object inscript/index.jsx.ts
- Call
evalScript
in your React component
// index.jsx.ts
import { id } from "../shared";
function alertFromScript(message) {
alert(message);
}
$.global[id] = {
alertFromScript,
};
// Component.jsx
import * as React from "react";
export function Component() {
const { evalScript } = useExtension();
return (
<button onClick={() => evalScript('alertFromScript("Hey!")')}>Alert</button>
);
}
You can log events from React in a similar way:
// Component.jsx
import * as React from "react";
export function Component() {
const { logMessage } = useLogger();
return (
<button onClick={() => logMessage("info", "Logged info from panel")}>
Log info
</button>
);
}
This will append a log message to a file on disk.