mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-07 07:21:17 +08:00
Merge pull request #2428 from jgoz/fix-actions-undefined-descriptor
[addon-actions] Check result of getPropertyDescriptor for IE11
This commit is contained in:
commit
267b90a882
@ -24,8 +24,10 @@ export function action(name) {
|
||||
});
|
||||
};
|
||||
|
||||
// IE11 may return an undefined descriptor, but it supports Function#name
|
||||
const nameDescriptor = Object.getOwnPropertyDescriptor(handler, 'name');
|
||||
// This condition is true in modern browsers that implement Function#name properly
|
||||
const canConfigureName = Object.getOwnPropertyDescriptor(handler, 'name').configurable;
|
||||
const canConfigureName = !nameDescriptor || nameDescriptor.configurable;
|
||||
|
||||
if (canConfigureName && name && typeof name === 'string') {
|
||||
Object.defineProperty(handler, 'name', { value: name });
|
||||
|
Loading…
x
Reference in New Issue
Block a user