Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F100809752
index.d.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Feb 2, 23:07
Size
802 B
Mime Type
text/x-java
Expires
Tue, Feb 4, 23:07 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
24036124
Attached To
rOACCT Open Access Compliance Check Tool (OACCT)
index.d.ts
View Options
/**
Define a [lazily evaluated](https://en.wikipedia.org/wiki/Lazy_evaluation) property on an object.
@param object - Object to add property to.
@param propertyName - Name of the property to add.
@param fn - Called the first time `propertyName` is accessed.
@example
```
import defineLazyProp = require('define-lazy-prop');
const unicorn = {
// …
};
defineLazyProp(unicorn, 'rainbow', () => expensiveComputation());
app.on('user-action', () => {
doSomething(unicorn.rainbow);
});
```
*/
declare function defineLazyProp<
ObjectType extends {[key: string]: unknown},
PropertyNameType extends string,
PropertyValueType
>(
object: ObjectType,
propertyName: PropertyNameType,
fn: () => PropertyValueType
): ObjectType & {[K in PropertyNameType]: PropertyValueType};
export = defineLazyProp;
Event Timeline
Log In to Comment