Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

prime

Package Overview
Dependencies
Maintainers
2
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prime - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

.idea/.name

36

defer.js

@@ -5,15 +5,14 @@ /*

var type = require("./type"),
uid = require("./uid"),
now = require("./date/now"),
count = require("./object/count")
var type = require("./type"),
now = require("./date/now"),
forEach = require("./array/forEach"),
indexOf = require("./array/indexOf")
var callbacks = {
timeout: {},
frame: {},
immediate: {}
frame: [],
immediate: []
}
var push = function(collection, callback, context, defer){
var unique = uid()

@@ -24,5 +23,5 @@ var iterator = function(){

if (count(collection, 0)) defer(iterator)
if (!collection.length) defer(iterator)
collection[unique] = {
var entry = {
callback: callback,

@@ -32,4 +31,7 @@ context: context

collection.push(entry)
return function(){
delete collection[unique]
var io = indexOf(collection, entry)
if (io > -1) collection.splice(io, 1)
}

@@ -41,13 +43,5 @@ }

var exec = {}, key
for (key in collection){
exec[key] = collection[key]
delete collection[key]
}
for (key in exec){
var entry = exec[key]
forEach(collection.splice(0), function(entry) {
entry.callback.call(entry.context, time)
}
})
}

@@ -119,3 +113,3 @@

return push(ct[ms] || (ct[ms] = {}), callback, context, function(iterator){
return push(ct[ms] || (ct[ms] = []), callback, context, function(iterator){
setTimeout(iterator, ms)

@@ -122,0 +116,0 @@ })

@@ -5,8 +5,8 @@ /*

var prime = require("./index"),
defer = require("./defer"),
uid = require("./uid"),
slice = require("./array/slice")
var prime = require("./index"),
defer = require("./defer"),
indexOf = require("./array/indexOf"),
forEach = require("./array/forEach")
var EID = 0
var slice = Array.prototype.slice;

@@ -17,7 +17,6 @@ var Emitter = prime({

var listeners = this._listeners || (this._listeners = {}),
events = listeners[event] || (listeners[event] = {})
events = listeners[event] || (listeners[event] = [])
for (var k in events) if (events[k] === fn) return this
if (indexOf(events, fn) === -1) events.push(fn)
events[uid()] = fn
return this

@@ -30,16 +29,7 @@ },

for (var k in events){
length++
if (key == null && events[k] === fn) key = k
if (key && length > 1) break
}
if (key){
delete events[key]
if (length === 1){
delete listeners[event]
for (var l in listeners) return this
delete this._listeners
}
}
var io = indexOf(events, fn)
if (io > -1) events.splice(io, 1)
if (!events.length) delete listeners[event];
for (var l in listeners) return this
delete this._listeners
}

@@ -51,3 +41,3 @@ return this

var self = this,
args = slice(arguments, 1)
args = slice.call(arguments, 1)

@@ -57,10 +47,6 @@ var emit = function(){

if (listeners && (events = listeners[event])){
var copy = {}, k
for (k in events) copy[k] = events[k]
for (k in copy) {
var res = copy[k].apply(self, args)
if (res === false) break;
}
forEach(events.slice(0), function(event){
return event.apply(self, args)
})
}
}

@@ -67,0 +53,0 @@

{
"name": "prime",
"homepage": "https://github.com/mootools/prime",
"version": "0.3.0",
"version": "0.3.1",
"main": "./index.js",

@@ -23,3 +23,3 @@ "description": "prime, an OOP JavaScript library for node and the web.",

},
"license": "MIT (http://mootools.net/license.txt)",
"license": "MIT",
"repository": {

@@ -26,0 +26,0 @@ "type": "git",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc