domain-singleton

3.0.0 • Public • Published

appoint one page or frame on a domain to handle a task

Usage

var domainSingleton = require('domain-singleton')
var pageBus = require('page-bus')

window.addEventListener('DOMContentLoaded', function () {
  domainSingleton({
    task: 'connect-to-peers',
    bus: pageBus(),
    onAppointed: function () {
      document.body.innerHTML = 'Appointed'
      // ...
    }
  })
})

Bundling Notes

This package uses require('assert') assertions. You may like to remove those statements from production bundles with a tool like unassertify.

This package uses debug to log debugging messages. You can enable logging with localStorage.debug = 'domain-singleton:*' or localStorage.debug = 'domain-singleton:{task}', where task is the string passed as options.task.

Licensing

This package is to free to use in open source under the terms of the License Zero Reciprocal Public License.

Licenses for use in closed and proprietary software are available via licensezero.com.

L0

Dependents (0)

Package Sidebar

Install

npm i domain-singleton

Weekly Downloads

5

Version

3.0.0

License

SEE LICENSE IN LICENSE

Unpacked Size

9.46 kB

Total Files

7

Last publish

Collaborators

  • kemitchell