Skip to content

Commit

Permalink
4.0.0-pre.4 with Issue #15 Avoid multiple deprecation warnings for ob…
Browse files Browse the repository at this point in the history
…serveParams property
  • Loading branch information
t2ym committed Mar 2, 2019
1 parent f29349f commit 563c07a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion i18n-format.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,10 @@ export class I18nFormat extends polyfill(HTMLElement) {
return true;
}
set observeParams(value) {
console.warn(`${this.is}: observeParams is deprecated and has a read-only dummy value true.`);
if (!this.constructor._observeParamsWarned) {
console.warn(`${this.is}: observeParams is deprecated and has a read-only dummy value true.`);
this.constructor._observeParamsWarned = true;
}
}

connectedCallback() {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"homepage": "https://github.com/t2ym/i18n-format#readme",
"name": "i18n-format",
"version": "4.0.0-pre.3",
"version": "4.0.0-pre.4",
"main": "i18n-format.js",
"directories": {
"test": "test"
Expand Down
2 changes: 2 additions & 0 deletions test/basic-test.html
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,8 @@
assert.equal(el.observeParams, true, 'default observeParams is true');
el.observeParams = false;
assert.equal(el.observeParams, true, 'observeParams is always true');
el.observeParams = false;
assert.equal(el.observeParams, true, 'observeParams is always true');
});

test('default textContent is empty', function () {
Expand Down

0 comments on commit 563c07a

Please sign in to comment.