New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

on-performance

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

on-performance - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

12

index.js

@@ -25,14 +25,12 @@ var onIdle = require('on-idle')

onIdle(function () {
cb(entry)
clear(entry)
cb(entry)
})
})
return observer.disconnect.bind(observer)
function handler (list) {
list.getEntries().forEach(function (entry) {
onIdle(function () {
cb(entry)
clear(entry)
cb(entry)
})

@@ -42,2 +40,8 @@ })

// Workaround to prevent the observer instance from being garbage collected
// https://twitter.com/yoshuawuyts/status/876098840495091713
window['obs' + window.performance.now()] = observer
return observer.disconnect.bind(observer)
// Navigation, longtask and frame don't have a clear method (yet)

@@ -44,0 +48,0 @@ // Resource timings can only be cleared in bulk

@@ -5,3 +5,3 @@ {

"repository": "yoshuawuyts/on-performance",
"version": "1.0.0",
"version": "1.0.1",
"scripts": {

@@ -8,0 +8,0 @@ "deps": "dependency-check . && dependency-check . --extra --no-dev",

@@ -7,8 +7,17 @@ var nanotiming = require('nanotiming')

tape('should flush already buffered events', function (assert) {
assert.plan(3) // bundle.js, bundle.css and start event
var startLength = window.performance.getEntries().length
var i = 0
var stop = onPerformance(function (entry) {
assert.ok(entry, 'entry passed')
if (i++ === 2) stop()
i++
endMaybe()
})
endMaybe() // call once at the start to if startLength === 0
function endMaybe () {
assert.pass('endMaybe called')
if (i < startLength) return
if (stop) stop()
assert.end()
}
})

@@ -20,12 +29,9 @@

var startLength = window.performance.getEntries().length
var firstIgnored = false
var stop = onPerformance(function (entry) {
if (!firstIgnored) {
firstIgnored = true
return
}
if (entry.entryType !== 'measure') return
assert.ok(entry, 'entry was passed')
var newLength = window.performance.getEntries().length
assert.equal(startLength, newLength, 'entries are cleared')
assert.equal(entry.entryType, 'measure')
stop()

@@ -32,0 +38,0 @@ })

Sorry, the diff of this file is not supported yet

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