Make require algorithm names static
Closed this issue · 0 comments
rclai commented
The way you're including the algorithms dynamically breaks other platforms that rely on static analysis or don't allow dynamic requires, for example, React Native. Are you able to make the requires static, for example:
if (algorithmName === 'Mahony') {
algorithmFn = new (require('./Mahony'))(sampleInterval, options);
} else if (algorithmName === 'Madgwick') {
algorithmFn = new (require('./Madgwick'))(sampleInterval, options);
}