New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Evaluate lazily Android specific global values #2002
Conversation
@@ -31,7 +32,7 @@ export function _clearForwardTransitions(fragment: any): void { | |||
fragment[EXIT_POPENTER_TRANSITION] = undefined; | |||
} | |||
|
|||
if (_sdkVersion >= 21) { | |||
if (_sdkVersion() >= 21) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
error TS2365: Operator '>=' cannot be applied to types '() => number' and 'number'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll take a look. It's compiling fine on my machine, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@enchev This is fixed now.
Sounds very neat. |
b7cb330
to
3a3bbea
Compare
3a3bbea
to
68b65ce
Compare
👍 |
2 similar comments
👍 |
👍 |
let _value: T; | ||
return () => _value || (_value = action()); | ||
})(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we reuse the outer scope :D
export default function lazy<T>(action: () => T): () => T {
let cache: T;
return () => cache || (cache = action());
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PanayotCankov Yeah, the self-executing function is redundant.
A premature optimization on my end - maybe we can move the 👍 |
68b65ce
to
02df926
Compare
@hdeshev I like your suggestion, but let's push forward the webpack plugin. It will resolve such issues. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Related to: #1563
ping @atanasovg, @KristinaKoeva