-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #799 from Polymer/mixin-prototype
Allow mixin classes to have members added via .prototype calls.
- Loading branch information
Showing
22 changed files
with
296 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
.../gen-typescript-declarations/src/test/goldens/polymer-2/lib/legacy/legacy-data-mixin.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/** | ||
* DO NOT EDIT | ||
* | ||
* This file was automatically generated by | ||
* https://github.com/Polymer/tools/tree/master/packages/gen-typescript-declarations | ||
* | ||
* To modify these typings, edit the source file(s): | ||
* lib/legacy/legacy-data-mixin.html | ||
*/ | ||
|
||
|
||
// tslint:disable:variable-name Describing an API that's defined elsewhere. | ||
// tslint:disable:no-any describes the API as best we are able today | ||
|
||
/// <reference path="class.d.ts" /> | ||
/// <reference path="../../polymer.d.ts" /> | ||
/// <reference path="../utils/mixin.d.ts" /> | ||
/// <reference path="../utils/templatize.d.ts" /> | ||
|
||
declare class UndefinedArgumentError extends Error { | ||
constructor(message: any, arg: any); | ||
} | ||
|
||
declare namespace Polymer { | ||
|
||
|
||
/** | ||
* Mixin to selectively add back Polymer 1.x's `undefined` rules | ||
* governing when observers & computing functions run based | ||
* on all arguments being defined (reference https://www.polymer-project.org/1.0/docs/devguide/observers#multi-property-observers). | ||
* | ||
* When loaded, all legacy elements (defined with `Polymer({...})`) | ||
* will have the mixin applied. The mixin only restores legacy data handling | ||
* if `_legacyUndefinedCheck: true` is set on the element's prototype. | ||
* | ||
* This mixin is intended for use to help migration from Polymer 1.x to | ||
* 2.x+ by allowing legacy code to work while identifying observers and | ||
* computing functions that need undefined checks to work without | ||
* the mixin in Polymer 2. | ||
*/ | ||
function LegacyDataMixin<T extends new (...args: any[]) => {}>(base: T): T & LegacyDataMixinConstructor; | ||
|
||
interface LegacyDataMixinConstructor { | ||
new(...args: any[]): LegacyDataMixin; | ||
|
||
/** | ||
* Overrides `Polyer.PropertyEffects` to wrap effect functions to | ||
* catch `UndefinedArgumentError`s and warn. | ||
* | ||
* @param templateInfo Template metadata to add effect to | ||
* @param prop Property that should trigger the effect | ||
* @param effect Effect metadata object | ||
*/ | ||
_addTemplatePropertyEffect(templateInfo: object|null, prop: string, effect?: object|null): void; | ||
} | ||
|
||
interface LegacyDataMixin { | ||
readonly _legacyUndefinedCheck: any; | ||
|
||
/** | ||
* Overrides `Polyer.PropertyEffects` to wrap effect functions to | ||
* catch `UndefinedArgumentError`s and warn. | ||
* | ||
* @param property Property that should trigger the effect | ||
* @param type Effect type, from this.PROPERTY_EFFECT_TYPES | ||
* @param effect Effect metadata object | ||
*/ | ||
_addPropertyEffect(property: string, type: string, effect?: object|null): void; | ||
} | ||
} | ||
|
||
declare class LegacyDataMixin extends superClass { | ||
|
||
/** | ||
* Overrides `Polyer.PropertyEffects` to wrap effect functions to | ||
* catch `UndefinedArgumentError`s and warn. | ||
* | ||
* @param templateInfo Template metadata to add effect to | ||
* @param prop Property that should trigger the effect | ||
* @param effect Effect metadata object | ||
*/ | ||
static _addTemplatePropertyEffect(templateInfo: object|null, prop: string, effect?: object|null): void; | ||
|
||
/** | ||
* Overrides `Polyer.PropertyEffects` to wrap effect functions to | ||
* catch `UndefinedArgumentError`s and warn. | ||
* | ||
* @param property Property that should trigger the effect | ||
* @param type Effect type, from this.PROPERTY_EFFECT_TYPES | ||
* @param effect Effect metadata object | ||
*/ | ||
_addPropertyEffect(property: string, type: string, effect?: object|null): void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
packages/gen-typescript-declarations/src/test/goldens/polymer-2/lib/utils/telemetry.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* DO NOT EDIT | ||
* | ||
* This file was automatically generated by | ||
* https://github.com/Polymer/tools/tree/master/packages/gen-typescript-declarations | ||
* | ||
* To modify these typings, edit the source file(s): | ||
* lib/utils/telemetry.html | ||
*/ | ||
|
||
|
||
// tslint:disable:variable-name Describing an API that's defined elsewhere. | ||
|
||
/// <reference path="boot.d.ts" /> | ||
|
||
declare namespace Polymer { | ||
|
||
/** | ||
* Provides basic tracking of element definitions (registrations) and | ||
* instance counts. | ||
*/ | ||
namespace telemetry { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.