Search
Search
subscribeToIsAllowedTo
subscribeToIsAllowedTo
Subscribe to changes in whether the user is allowed to execute methods.
console.log(`Initial: ${framer.isAllowedTo("addText")}`) const unsub = framer.subscribeToIsAllowedTo("addText", (isAllowed) => { console.log(`New: ${isAllowed}`) unsub() })
Signature
subscribeToIsAllowedTo: ( ...args: [ ...methods: [ProtectedMethod, ...ProtectedMethod[]], callback: (isAllowed: boolean) => void, ] ) => Unsubscribe;
Parameters
methods
– The methods to check, at least one.callback
– The function that's called every timeisAllowed
changes, whereisAllowed
istrue
if all ofmethods
can be executed, andfalse
otherwise.
Returns
Unsubscribe
– The function to call to unsubscribe.
Notes
Learn more with the Permission guide.