subscribeToIsAllowedTo

subscribeToIsAllowedTo

Subscribe to changes in framer.isAllowedTo(...methods):

framer.subscribeToIsAllowedTo(args: [...methods: [ProtectedMethod, ...ProtectedMethod[]], callback: (isAllowed: boolean) => void]): Unsubscribe
console.log(`Initial isAllowed: ${framer.isAllowedTo("addImage")}`)
framer.subscribeToIsAllowedTo("addImage", (isAllowed) => {
    console.log(`New isAllowed: ${isAllowed}`)
})

Refer to useIsAllowedTo for a React hook version of this.

Parameters

Returns

  • Unsubscribe – A function to call to unsubscribe.