Socket
Socket
Sign inDemoInstall

annotation-poller

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

annotation-poller - npm Package Compare versions

Comparing version 2.0.2 to 2.1.0

15

CHANGELOG.md

@@ -5,2 +5,17 @@ # Change Log

<a name="2.1.0"></a>
# [2.1.0](https://github.com/npm/annotation-poller/compare/v2.0.2...v2.1.0) (2016-05-18)
### Bug Fixes
* immediately poll when we load, don't stop polling on failure ([#6](https://github.com/npm/annotation-poller/issues/6)) ([fe82a02](https://github.com/npm/annotation-poller/commit/fe82a02))
### Features
* maintain element ordering in UI ([#7](https://github.com/npm/annotation-poller/issues/7)) ([d440f01](https://github.com/npm/annotation-poller/commit/d440f01))
<a name="2.0.2"></a>

@@ -7,0 +22,0 @@ ## [2.0.2](https://github.com/npm/annotation-poller/compare/v2.0.1...v2.0.2) (2016-04-21)

48

index.js

@@ -26,4 +26,4 @@ var $ = require('jquery')

Handlebars.registerHelper('isArray', function (obj, key, options) {
if ($.isArray(obj[key])) {
Handlebars.registerHelper('isArray', function (obj, options) {
if ($.isArray(obj)) {
return options.fn(this)

@@ -39,18 +39,22 @@ } else {

var updating = false
var poll = function () {
if (updating) return
updating = true
_this.getAnnotations(function () {
updating = false
_this.renderAnnotations()
if (loaded) {
loaded()
loaded = null
}
})
}
$(document).ready(function () {
this.interval = setInterval(function () {
if (updating) return
updating = true
_this.getAnnotations(function () {
updating = false
_this.renderAnnotations()
if (loaded) {
loaded()
loaded = null
}
})
poll()
}, _this.pollInterval)
})
poll()
}

@@ -68,2 +72,3 @@

})
}).always(function () {
return cb()

@@ -101,3 +106,5 @@ })

if ($.isArray(obj.rows)) {
obj.rows.forEach(function (row) {
obj.rows.forEach(function (row, i) {
var flattenedRow = []
// bold any text in between *foo*.

@@ -122,2 +129,14 @@ if (row.text) {

}
// flatten the row object into an ordered
// set of elements. In our template we output
// the elements in the order that the keys appear.
Object.keys(row).forEach(function (key) {
var element = row[key]
if (typeof element === 'string') element = {text: element}
element['_' + key] = true
flattenedRow.push(element)
})
obj.rows[i] = flattenedRow
})

@@ -129,2 +148,3 @@ } else {

}
return obj

@@ -131,0 +151,0 @@ }

{
"name": "annotation-poller",
"version": "2.0.2",
"version": "2.1.0",
"description": "poll for annotations from external services, place them on packages",
"main": "index.js",
"scripts": {
"pretest": "handlebars annotation.mustache -f annotation.js",
"build": "handlebars annotation.mustache -f annotation.js",
"pretest": "npm run build",
"prepublish": "npm run build",
"test": "nyc mocha --timeout=10000 test.js",

@@ -28,12 +30,12 @@ "coverage": "nyc report --reporter=text-lcov | coveralls",

"devDependencies": {
"browserify": "^13.0.0",
"browserify": "^13.0.1",
"chai": "^3.5.0",
"coveralls": "^2.11.9",
"jquery-mockjax": "^2.1.1",
"jsdom": "^8.3.0",
"jsdom-global": "^1.7.0",
"jsdom": "^9.1.0",
"jsdom-global": "^2.0.0",
"mocha": "^2.4.5",
"nyc": "^6.1.1",
"standard": "^6.0.8",
"standard-version": "^2.1.2"
"nyc": "^6.4.4",
"standard": "^7.1.0",
"standard-version": "^2.2.1"
},

@@ -40,0 +42,0 @@ "dependencies": {

@@ -77,2 +77,46 @@ /* global describe, it, beforeEach */

it('gracefully handles an upstream error', function (done) {
$.mockjax({
url: endpoint,
status: 500,
responseText: "ENOGOOD"
})
var poller = annotationPoller({pollInterval: 50, pkg: pkg})
poller.start(function () {
poller.stop()
return done()
})
})
it('respects the element ordering', function (done) {
$.mockjax({
url: endpoint,
responseText: [{
id: 'abc-123-abc',
name: 'second integration',
fingerprint: 'bb',
rows: [{
link: {
url: 'http://www.example.com',
text: 'my awesome link'
},
image: {
url: 'http://www.example.com/img',
text: 'image alt'
}
}]
}]
})
var poller = annotationPoller({pollInterval: 50, pkg: pkg})
poller.start(function () {
var children = $('.addon-container li:eq(1)').children()
$(children[0]).is('a').should.equal(true)
$(children[1]).is('img').should.equal(true)
poller.stop()
return done()
})
})
it('replaces *text* with bold', function (done) {

@@ -79,0 +123,0 @@ $.mockjax({

Sorry, the diff of this file is not supported yet

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