fixed definition files for polymer (description on app router and any

types)
This commit is contained in:
unknown
2015-03-11 10:44:54 +01:00
parent 83ad8f1d9a
commit 063a6ccc29
3 changed files with 13 additions and 12 deletions
+4 -8
View File
@@ -10,10 +10,6 @@ class AbstractPolymerElement implements PolymerElement {
asyncFire(eventName: string, details?: any, targetNode?: any, bubbles?: boolean, cancelable?: boolean): void { }
cancelUnbindAll(): void { }
// these are mix in API's.. hacky way to deal with them at the moment.
resizableAttachedHandler;
resizableDetachedHandler;
}
class AbstractWebComponent extends AbstractPolymerElement {
@@ -30,11 +26,10 @@ class AbstractWebComponent extends AbstractPolymerElement {
}
}
function registerWebComponent(webComponentClass: Function, ...mixins): void {
function registerWebComponent(webComponentClass: Function, ...mixins: any[]): void {
// we need a flat object, without prototype in order to polymer to work on our components
var flattenedComponent = {};
var poly_func = ["async", "job", "fire", "asyncFire", "cancelUnbindAll"];
var flattenedComponent: any = {};
if (mixins) {
// apply mixins
mixins.forEach(mixin => {
@@ -47,7 +42,8 @@ function registerWebComponent(webComponentClass: Function, ...mixins): void {
}
var webComponent: AbstractWebComponent = new (<any>webComponentClass)();
for (var i in webComponent) {
if (!_.contains(poly_func, i)) {
// do not include polymer functions
if (i != "async" && i != "job" && i != "fire" && i != "asyncFire" && i != "cancelUnbindAll") {
flattenedComponent[i] = webComponent[i];
}
}
+5
View File
@@ -1,3 +1,8 @@
// Type definitions for app-router
// Project: https://github.com/erikringsmuth/app-router
// Definitions by: Louis Grignon <https://github.com/lgrignon>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module PolymerComponents {
module App {
export interface Router extends HTMLElement {
+4 -4
View File
@@ -22,16 +22,16 @@ interface PolymerElement {
interface Polymer {
importElements(node: Node, callback: Function);
importElements(node: Node, callback: Function): void;
import(url: string, callback?: () => void): void;
mixin(target: any, ...obj1): any;
mixin(target: any, ...mixins: any[]): any;
waitingFor(): Array<string>;
// should be an "integer" for milliseconds
forceReady(timeout: number): void;
(tag_name: string, prototype: PolymerElement): void;
(tag_name: string, prototype: any): void;
(tagName: string, prototype: PolymerElement): void;
(tagName: string, prototype: any): void;
(prototype: PolymerElement): void;
(): void;
// hacks for mixins