Skip to content

Commit 47db0f2

Browse files
authored
prepare 2.7.3 release (#123)
1 parent 5567117 commit 47db0f2

16 files changed

+129
-48
lines changed

.eslintrc.yaml

Lines changed: 57 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,51 +5,105 @@ extends:
55
env:
66
es6: true
77
node: true
8-
browser: true
98
plugins:
109
- babel
1110
- prettier
1211
globals:
1312
VERSION: true
13+
describe: true
14+
it: true
15+
expect: true
16+
jest: true
17+
beforeEach: true
18+
afterEach: true
19+
window: true
20+
document: true
1421
rules:
22+
# https://github.com/prettier/eslint-plugin-prettier
1523
prettier/prettier:
1624
- error
25+
26+
# https://github.com/babel/eslint-plugin-babel
27+
babel/semi: error
28+
29+
# https://eslint.org/docs/rules/array-callback-return
1730
array-callback-return: error
31+
32+
# https://eslint.org/docs/rules/curly
1833
curly:
1934
- error
2035
- all
36+
37+
# https://eslint.org/docs/rules/no-implicit-coercion
2138
no-implicit-coercion:
2239
- 'off'
2340
- boolean: false
2441
number: true
2542
string: true
2643
allow: []
44+
45+
# https://eslint.org/docs/rules/no-eval
2746
no-eval: error
47+
48+
# https://eslint.org/docs/rules/no-implied-eval
2849
no-implied-eval: error
50+
51+
# https://eslint.org/docs/rules/no-param-reassign
2952
no-param-reassign:
3053
- error
3154
- props: true
55+
56+
# https://eslint.org/docs/rules/no-return-assign
3257
no-return-assign: error
58+
59+
# https://eslint.org/docs/rules/no-self-compare
3360
no-self-compare: error
61+
62+
# https://eslint.org/docs/rules/radix
3463
radix: error
64+
65+
# https://eslint.org/docs/rules/no-array-constructor
3566
no-array-constructor: error
67+
68+
# https://eslint.org/docs/rules/no-new-wrappers
3669
no-new-wrappers: error
70+
71+
# https://eslint.org/docs/rules/no-cond-assign
3772
no-cond-assign: error
73+
74+
# https://eslint.org/docs/rules/no-use-before-define
3875
no-use-before-define:
3976
- error
4077
- functions: false
78+
79+
# https://eslint.org/docs/rules/eqeqeq
4180
eqeqeq: error
4281

4382
# Deprecations are required to turn enforce this
4483
camelcase: warn
45-
84+
85+
# https://eslint.org/docs/rules/no-new-object
4686
no-new-object: error
87+
88+
# https://eslint.org/docs/rules/no-nested-ternary
4789
no-nested-ternary: error
90+
91+
# https://eslint.org/docs/rules/no-unused-vars
4892
no-unused-vars: error
93+
94+
# https://eslint.org/docs/rules/no-var
4995
no-var: error
96+
97+
# https://eslint.org/docs/rules/prefer-const
5098
prefer-const: error
99+
100+
# https://eslint.org/docs/rules/prefer-arrow-callback
51101
prefer-arrow-callback: error
102+
103+
# https://eslint.org/docs/rules/arrow-body-style
52104
arrow-body-style:
53105
- error
54106
- as-needed
55-
babel/semi: error
107+
108+
# https://eslint.org/docs/rules/no-undef
109+
no-undef: error

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
All notable changes to the LaunchDarkly client-side JavaScript SDK will be documented in this file.
44
This project adheres to [Semantic Versioning](http://semver.org).
55

6+
## [2.7.3] - 2018-11-09
7+
### Fixed:
8+
- The TypeScript definitions were incorrectly restricting the possible values for event types in `on()` and `off()`. Also, added documentation for event types which were not documented before. ([#122](https://github.com/launchdarkly/js-client/issues/122))
9+
610
## [2.7.2] - 2018-10-17
711
### Fixed:
812
- Disconnecting from the stream does not close the browser tab anymore.

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ldclient-js",
3-
"version": "2.7.2",
3+
"version": "2.7.3",
44
"description": "LaunchDarkly SDK for JavaScript",
55
"author": "LaunchDarkly <[email protected]>",
66
"license": "Apache-2.0",

src/EventProcessor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export default function EventProcessor(eventsUrl, environmentId, options = {}, e
3131
samplingInterval = options.samplingInterval || 0;
3232
}
3333

34-
if (options.flushInterval !== undefined && (isNan(options.flushInterval) || options.flushInterval < 2000)) {
34+
if (options.flushInterval !== undefined && (isNaN(options.flushInterval) || options.flushInterval < 2000)) {
3535
flushInterval = 2000;
3636
reportArgumentError('Invalid flush interval configured. Must be an integer >= 2000 (milliseconds).');
3737
} else {

src/EventSender.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default function EventSender(eventsUrl, environmentId, forceHasCors, imag
1010
const sender = {};
1111

1212
function loadUrlUsingImage(src, onDone) {
13-
const img = new Image();
13+
const img = new window.Image();
1414
if (onDone) {
1515
img.addEventListener('load', onDone);
1616
}
@@ -34,7 +34,7 @@ export default function EventSender(eventsUrl, environmentId, forceHasCors, imag
3434
const jsonBody = JSON.stringify(events);
3535
const send = onDone => {
3636
function createRequest(canRetry) {
37-
const xhr = new XMLHttpRequest();
37+
const xhr = new window.XMLHttpRequest();
3838
xhr.open('POST', postUrl, !sync);
3939
utils.addLDHeaders(xhr);
4040
xhr.setRequestHeader('Content-Type', 'application/json');
@@ -76,7 +76,7 @@ export default function EventSender(eventsUrl, environmentId, forceHasCors, imag
7676
// Detect browser support for CORS (can be overridden by tests)
7777
if (hasCors === undefined) {
7878
if (forceHasCors === undefined) {
79-
hasCors = 'withCredentials' in new XMLHttpRequest();
79+
hasCors = 'withCredentials' in new window.XMLHttpRequest();
8080
} else {
8181
hasCors = forceHasCors;
8282
}

src/GoalTracker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export default function GoalTracker(goals, onEvent) {
6060
const urls = goal.urls || [];
6161

6262
for (let j = 0; j < urls.length; j++) {
63-
if (doesUrlMatch(urls[j], location.href, location.search, location.hash)) {
63+
if (doesUrlMatch(urls[j], window.location.href, window.location.search, window.location.hash)) {
6464
if (goal.kind === 'pageview') {
6565
onEvent('pageview', goal);
6666
} else {

src/Requestor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as messages from './messages';
55
const json = 'application/json';
66

77
function fetchJSON(endpoint, body, callback, sendLDHeaders) {
8-
const xhr = new XMLHttpRequest();
8+
const xhr = new window.XMLHttpRequest();
99
let data = undefined;
1010

1111
xhr.addEventListener('load', () => {

src/Store.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default function Store(environment, hash, ident) {
1717
const key = getFlagsKey();
1818
let dataStr, data;
1919
try {
20-
dataStr = localStorage.getItem(key);
20+
dataStr = window.localStorage.getItem(key);
2121
} catch (ex) {
2222
console.warn(messages.localStorageUnavailable());
2323
return null;
@@ -41,7 +41,7 @@ export default function Store(environment, hash, ident) {
4141
const key = getFlagsKey();
4242
const data = utils.extend({}, flags, { $schema: 1 });
4343
try {
44-
localStorage.setItem(key, JSON.stringify(data));
44+
window.localStorage.setItem(key, JSON.stringify(data));
4545
} catch (ex) {
4646
console.warn(messages.localStorageUnavailable());
4747
}
@@ -50,7 +50,7 @@ export default function Store(environment, hash, ident) {
5050
store.clearFlags = function() {
5151
const key = getFlagsKey();
5252
try {
53-
localStorage.removeItem(key);
53+
window.localStorage.removeItem(key);
5454
} catch (ex) {}
5555
};
5656

src/Stream.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default function Stream(baseUrl, environment, hash, config) {
2424
};
2525

2626
stream.isConnected = function() {
27-
return es && (es.readyState === EventSource.OPEN || es.readyState === EventSource.CONNECTING);
27+
return es && (es.readyState === window.EventSource.OPEN || es.readyState === window.EventSource.CONNECTING);
2828
};
2929

3030
function reconnect() {
@@ -45,7 +45,7 @@ export default function Stream(baseUrl, environment, hash, config) {
4545
function openConnection() {
4646
let url;
4747
let query = '';
48-
if (typeof EventSource !== 'undefined') {
48+
if (typeof window.EventSource !== 'undefined') {
4949
if (useReport) {
5050
// we don't yet have an EventSource implementation that supports REPORT, so
5151
// fall back to the old ping-based stream

0 commit comments

Comments
 (0)