Docs menu
on
Listen for what happens in the editor.
Usage
gnr.on("ready", () => { /* safe to call createPost / editPost */ });
gnr.on("error", (error) => console.error(error.code, error.message));
gnr.on("close", () => { /* the user closed the editor */ });
gnr.on("publish", (data) => { /* same data as onPostPublish */ });Events
| Event | When |
|---|---|
ready | The user is signed in and the editor can open. |
error | Something went wrong. error.code is one of APP_ID_REQUIRED, INITIALIZATION_FAILED (bad token, unknown App ID, website not allowed), NOT_READY, POST_ID_REQUIRED, POST_NOT_FOUND. |
close | The editor was closed. |
publish | The user pressed Publish. |
💡 Tip
Register every handler before initialize(), so an error while starting is not missed.