Catalog npm
PACKAGE EXPLORERView in registry

1t

npm

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

#ifndefglobalpragmasingleton
Versions collected1
Direct dependencies1From release 0.1.0
Last observed20 Oct, 18:38 UTC

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.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
0.1.0Registry latest18 Apr 20141

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

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:d985bba6f2fea02957f95f4f187f0200e894946077ae3917e0b68706c4c86d67