diff --git a/types/polymer/index.d.ts b/types/polymer/index.d.ts index 569842066a..1b67f4c6d5 100644 --- a/types/polymer/index.d.ts +++ b/types/polymer/index.d.ts @@ -263,7 +263,7 @@ declare global { setAttribute(name: string, value: any):void; removeAttribute(name: string):void; - + observeNodes(callback: (info: ObservedNodeInfo) => void): {}; unobserveNodes(observer: {}): void; @@ -340,6 +340,12 @@ declare global { whenLoaded(cb: Function): void; } + interface Templatizer { + templatize(template: HTMLTemplateElement, mutableData?: boolean): void; + stamp(model: {}): Base; + modelForElement: (elem: HTMLElement) => Base; + } + interface PolymerStatic { Settings: Settings; @@ -351,12 +357,14 @@ declare global { Class(prototype: Base | { new (): Base }): CustomElementConstructor; - RenderStatus: RenderStatus + RenderStatus: RenderStatus; ArraySplice: ArraySplice; /** @deprecated */ - ImportStatus: ImportStatus + ImportStatus: ImportStatus; + + Templatizer: Templatizer; } } diff --git a/types/polymer/polymer-tests.ts b/types/polymer/polymer-tests.ts index 2b6631ffb7..ce55ac325d 100644 --- a/types/polymer/polymer-tests.ts +++ b/types/polymer/polymer-tests.ts @@ -1,6 +1,8 @@ Polymer({ is: "my-element", + behaviors: [Polymer.Templatizer], + properties: { prop1: String, prop2: { @@ -24,6 +26,11 @@ Polymer({ }, ready: function () { + const template = Polymer.dom(this).querySelector('template'); + if (template) { + this.templatize(template); + const instance = this.stamp({item: {}}); + } this.textContent = 'My element!'; this.$.name.textContent = this.name; this.serialize({});