source(file.path(usethis::proj_get(), "vignettes", "_common.R"))
Singleton ensures a class only has one instance, and provide a global point of access to it.
The main features of Singleton are:
Ensuring that one and only one object of the class gets created;
Providing an access point for an object that is global to the program; and
Controlling concurrent access to resources that are shared.
Counter
example.stop("Singletons can be a problem in multi-threaded applications, especially when they manipulate mutable data.")
message("Singletons work well for immutable data, such as reading from some data source, since anything that can’t change isn’t going to run into thread clash problems.")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.