![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.
@saleor/app-bridge
Advanced tools
npm i @saleor/app-bridge
First initialize the package by running createApp()
:
import { createApp } from "@saleor/app-bridge";
const app = createApp();
Access app state:
const { token, domain, ready, id } = app.getState();
Events are messages that originate in Saleor Dashboard.
subscribe(eventType, callback)
- can be used to listen to particular event type. It returns an unsubscribe function, which unregisters the callback.
Example:
const unsubscribe = app.subscribe("handshake", (payload) => {
setToken(payload.token); // do something with event payload
const { token } = app.getState(); // you can also get app's current state here
});
// unsubscribe when callback is no longer needed
unsubscribe();
unsubscribeAll(eventType?)
- unregisters all callbacks of provided type. If no type was provided, it will remove all event callbacks.
Example:
app.unsubscribeAll("handshake"); // unsubscribe from all handshake events
app.unsubscribeAll(); // unsubscribe from all events
Event type | Description |
---|---|
handshake | Fired when iFrame containing the App is initialized or new token is assigned |
response | Fired when Dashboard responds to an Action |
Actions expose a high-level API to communicate with Saleor Dashboard. They're exported under an actions
namespace.
dispatch(action)
- dispatches an Action. Returns a promise which resolves when action is successfully completed.
Example:
import { actions } from "@saleor/app-bridge";
const handleRedirect = async () => {
await app.dispatch(actions.Redirect({ to: "/orders" }));
console.log("Redirect complete!");
}
handleRedirect();
Action | Arguments | Description |
---|---|---|
Redirect | to (string) - relative (inside Dashboard) or absolute URL path | |
newContext (boolean) - should open in a new browsing context |
FAQs
Library for Dashboard <-> Saleor App communication
The npm package @saleor/app-bridge receives a total of 11 weekly downloads. As such, @saleor/app-bridge popularity was classified as not popular.
We found that @saleor/app-bridge demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 open source maintainers 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.