Comparing version 0.1.0 to 0.1.1
46
index.js
@@ -1,1 +0,45 @@ | ||
console.log('Comming soon'); | ||
'use strict'; | ||
var debug = require('./debug.js')('geotool:loadsync'); | ||
var loadsync = function loadsync(params) { | ||
debug && debug(' + constructor begin ...'); | ||
params = params || {}; | ||
params.states = params.states || []; | ||
this.define = function(opts) { | ||
opts = opts || {}; | ||
params.states = opts.states || params.states; | ||
debug && debug('define states: %s', JSON.stringify(params.states)); | ||
return this; | ||
} | ||
var callbacks = []; | ||
this.ready = function(callback) { | ||
debug && debug('append a new callback'); | ||
if (typeof(callback) === 'function') { | ||
callbacks.push(callback); | ||
} | ||
return this.check(); | ||
} | ||
this.check = function(state) { | ||
debug && debug('check state: %s', state); | ||
var stateInd = params.states.indexOf(state); | ||
if (stateInd >= 0) { | ||
params.states.splice(stateInd, 1); | ||
} | ||
if (params.states.length === 0) { | ||
debug && debug('ready, run all of callbacks'); | ||
callbacks.forEach(function(callback) { | ||
callback(); | ||
}); | ||
} | ||
return this; | ||
} | ||
debug && debug(' - constructor end!'); | ||
}; | ||
module.exports = new loadsync(); |
{ | ||
"name": "loadsync", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Load javascript libraries in browser synchronously", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
1626
4
43
0