Catalog npm
Back to packageRELEASE DETAILS

0.1.0

npm

1t

Ensures that only one instance of your module exists either serverside or in the browser.

#ifndefglobalpragmasingleton
Published18 Apr 2014
Direct dependencies1
Transitive dependenciesNot calculated

README

Current package documentation

1t build status

Ensures that only one instance of your module exists either serverside or in the browser.

1t == one ton == a singleton

var singleton = require('1t');

// #ifndef
singleton('__FOO__', module, function () {
// #define __FOO__

var path = require('path');

exports.hello = 'world';  
exports.filename = path.basename(__filename);

})
// #endif

Installation

npm install 1t

API

singleton(id, mdl, fn)

Ensures that only one instance for the wrapped module is instantiated. Works similar to #ifndef/#define pragmas in C

Parameters:
NameTypeDescription
id string

the unique id under which the module is stored in the global namespace

mdl Object

the module variable that is passed to each node/browserify module

fn function

function that wraps the code of the module

Source:

generated with docme

License

MIT

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 1

Native requirements
1 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
tap
Environment
{
  "local_name": "tap",
  "alias": false,
  "peer_metadata": null
}
~0.4.3development

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "shasum": "b3473f03c0a6b577e1f7a580501e472d81de756d",
  "tarball": "https://registry.npmjs.org/1t/-/1t-0.1.0.tgz",
  "integrity": "sha512-9iZSFce80YyQpUL/g7xxI4SEfzY1t9alMQlRyW8BwX0rULE7wg/ziTE4fpbUoepswJgIJyHMDlbDIJO4fPpzzQ==",
  "signatures": [
    {
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
      "sig": "MEYCIQD1v+gqMP1hrx58vXXkmf1cF8IuB4UMfrajeKXZvL+yJQIhANavH40fiucAI/uuEPFM7OaLYoZJO0njd/yYE1Yy9gWZ"
    }
  ]
}

Repository

PENDING
thlorenz/1t

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 18:38 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:78c7e6bb9946c4425dbf218359670a104fbfcd5bc0f948e27dbdde7f42366396

Other collected versions

View all collected versions →