Singleton
Last updated
Was this helpful?
Last updated
Was this helpful?
Sometimes, when we are creating libraries for other users, we might want to group similar functions together to improve user experience.
Suppose we are creating a library that allow the user to access the file system. And we wish that our code looks like this:
First, we need to create a with only a single tag:
Then, create a constant alias:
After that, we can proceed to define the functions we intend to expose:
And the client can use them as follows: