domain-singleton
v3.0.0
Published
appoint one page or frame on a domain to handle a task
Downloads
1
Readme
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.