Skip to content

Commit

Permalink
Add constructor name and fix mixin wrapping.
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinpschaaf committed Jun 22, 2018
1 parent a470e45 commit 6818554
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
15 changes: 12 additions & 3 deletions lib/legacy/legacy-data-mixin.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,19 @@
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->

<link rel="import" href="../class.html">
<link rel="import" href="class.html">
<link rel="import" href="../utils/mixin.html">

<script>
(function() {
'use strict';

const UndefinedArgumentError = class extends Error {};
const UndefinedArgumentError = class extends Error {
constructor(message) {
super(message);
this.name = this.constructor.name;
}
};

/**
* Mixin to selectively add back Polymer 1.x's `undefined` rules
Expand Down Expand Up @@ -96,7 +101,11 @@
});

const Class = Polymer.Class;
Polymer.Class = info => Class(info, Polymer.LegacyDataMixin);
Polymer.Class = (info, mixin) => Class(info,
superClass => mixin ?
mixin(Polymer.LegacyDataMixin(superClass)) :
Polymer.LegacyDataMixin(superClass)
);

console.info('LegacyDataMixin will be applied to all legacy elements.\n' +
'Set `_legacyUndefinedCheck: true` to enable.');
Expand Down
1 change: 1 addition & 0 deletions types/lib/legacy/legacy-data-mixin.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* lib/legacy/legacy-data-mixin.html
*/

/// <reference path="class.d.ts" />
/// <reference path="../utils/mixin.d.ts" />

declare class UndefinedArgumentError {
Expand Down

0 comments on commit 6818554

Please sign in to comment.