Search
Search
subscribeToIsAllowedTo
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 timeisAllowedchanges, whereisAllowedistrueif all ofmethodscan be executed, andfalseotherwise.
Returns
Unsubscribe– The function to call to unsubscribe.
Notes
Learn more with the Permission guide.