1.5.0 • Published 2 years ago
messy-integration v1.5.0
Messy Integration
This provides connectivity between the Messy User Area and the UIs of integrating services
via browser cross-origin communication utilizing window.postMessage
and <iframe>
s.
Integrate your own Service with Messy
- Install this package with
npm install messy-integration
- Load the Messy Integration:
import { startMessy } from "messy-integration";
const session = startMessy();
// Use session.onReady to show some loading animation, i.e.
(async function () {
showSpinner();
await session.onReady;
hideSpinner();
})();
- Whenever there's a Recipe in your application that the user wants to mix, start the integration:
const result = await session.run({
recipe: {
name: { en: "The best cake ever" },
tasks: [
{
name: "misc",
description: { en: "Switch on the oven" }
},
{
name: "add",
description: { en: "Two eggs" }
},
{
name: "fill",
amount: 1000,
amountInUnit: 1,
unit: "l",
ingredient: { en: "water" }
},
{
name: "fill",
amount: 1000,
amountInUnit: 900,
unit: "g",
ingredient: { en: "flour" }
},
]
}
});
For further details on the recipe see ./types.ts
.