---
id: fast-foundation.singleton
title: singleton() function
hide_title: true
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[@microsoft/fast-foundation](./fast-foundation.md) &gt; [singleton](./fast-foundation.singleton.md)

## singleton() function

Registers the decorated class as a singleton dependency; the class will only be created once. Each consecutive time the dependency is resolved, the same instance will be returned.

<b>Signature:</b>

```typescript
export declare function singleton<T extends Constructable>(): typeof singletonDecorator;
```
<b>Returns:</b>

typeof singletonDecorator

## Example


```ts
@singleton()
class Foo { }

```
