@segment/analytics.js-core
Advanced tools
Comparing version 3.11.4 to 3.12.4
@@ -0,2 +1,7 @@ | ||
# 3.12.4 / 2020-04-23 | ||
- test: add add/apply middleware stress test | ||
- update tests to not fail when adding middleware post-init | ||
- rm checks to disallow adding middleware post-init | ||
# v3.11.3 / 2020-04-13 | ||
@@ -7,2 +12,3 @@ | ||
# v3.11.0 | ||
- feat: use SameSite=Lax by default (#128) | ||
@@ -9,0 +15,0 @@ |
@@ -108,7 +108,2 @@ 'use strict'; | ||
Analytics.prototype.addSourceMiddleware = function(middleware) { | ||
if (this.initialized) | ||
throw new Error( | ||
'attempted to add a source middleware after initialization' | ||
); | ||
this._sourceMiddlewares.add(middleware); | ||
@@ -126,7 +121,2 @@ return this; | ||
Analytics.prototype.addIntegrationMiddleware = function(middleware) { | ||
if (this.initialized) | ||
throw new Error( | ||
'attempted to add an integration middleware after initialization' | ||
); | ||
this._integrationMiddlewares.add(middleware); | ||
@@ -133,0 +123,0 @@ return this; |
{ | ||
"name": "@segment/analytics.js-core", | ||
"author": "Segment <friends@segment.com>", | ||
"version": "3.11.4", | ||
"version": "3.12.4", | ||
"description": "The hassle-free way to integrate analytics into any web application.", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
@@ -348,2 +348,47 @@ 'use strict'; | ||
}); | ||
it('should be able to add and apply middleware interchangably', function() { | ||
chain.add(function(chain) { | ||
chain.payload.obj.test.push(1); | ||
chain.next(chain.payload); | ||
}); | ||
chain.applyMiddlewares({ test: [] }, 'Test', function(payload) { | ||
assert.deepEqual(payload.obj.test, [1]); | ||
}); | ||
chain.add(function(chain) { | ||
chain.payload.obj.test.push(2); | ||
chain.next(chain.payload); | ||
}); | ||
chain.applyMiddlewares({ test: [] }, 'Test', function(payload) { | ||
assert.deepEqual(payload.obj.test, [1, 2]); | ||
}); | ||
chain.add(function(chain) { | ||
chain.payload.obj.test.push(3); | ||
chain.next(chain.payload); | ||
}); | ||
chain.applyMiddlewares({ test: [] }, 'Test', function(payload) { | ||
assert.deepEqual(payload.obj.test, [1, 2, 3]); | ||
}); | ||
chain.add(function(chain) { | ||
chain.payload.obj.test.push(4); | ||
chain.next(chain.payload); | ||
}); | ||
chain.applyMiddlewares({ test: [] }, 'Test', function(payload) { | ||
assert.deepEqual(payload.obj.test, [1, 2, 3, 4]); | ||
}); | ||
chain.add(function(chain) { | ||
chain.payload.obj.test.push(5); | ||
chain.next(chain.payload); | ||
}); | ||
chain.applyMiddlewares({ test: [] }, 'Test', function(payload) { | ||
assert.deepEqual(payload.obj.test, [1, 2, 3, 4, 5]); | ||
}); | ||
chain.add(function(chain) { | ||
chain.payload.obj.test.push(6); | ||
chain.next(chain.payload); | ||
}); | ||
chain.applyMiddlewares({ test: [] }, 'Test', function(payload) { | ||
assert.deepEqual(payload.obj.test, [1, 2, 3, 4, 5, 6]); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is too big to display
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
241175
5629