Skip to content
This repository was archived by the owner on Feb 21, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Ajax.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ interface AjaxPeriodicalUpdater {
interface AjaxRequest {
getHeader(name: string): string;

success(): bool;
success(): boolean;
}

interface AjaxResponders {
register(responder: object): void;
register(responder: Object): void;

unregister(responder: object): void;
unregister(responder: Object): void;
}

interface AjaxResponse {
Expand All @@ -25,13 +25,13 @@ interface AjaxResponse {

getResponseHeader(name: string): string;

headerJSON: object;
headerJSON: Object;

readyState: number;

request: AjaxRequest;

responseJSON: object;
responseJSON: Object;

responseText: string;

Expand Down Expand Up @@ -64,4 +64,4 @@ interface Ajax {

activeRequestCount: number;

}
}
14 changes: 7 additions & 7 deletions Enumerable.d.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
interface Enumerable {
all(iterator, context): bool;
any(iterator, context): bool;
all(iterator, context): boolean;
any(iterator, context): boolean;
collect(iterator, context): any[];
detect(iterator, context): Element;
each(iterator, context): Enumerable;
eachSlice(number, iterator, context): Enumerable;
entries(): any[];
every(iterator, context): bool;
every(iterator, context): boolean;
filter(iterator, context): any[];
find(iterator, context): Element;
findAll(iterator, context): any[];
grep(filter, iterator, context): any[];
include(object): bool;
include(object): boolean;
inGroupsOf(number, fillWith): any[];
inject(memo, iterator, context): any[];
inspect(): string;
invoke(method): any[];
map(iterator, context): any[];
max(iterator, context): any;
member(object): bool;
member(object): boolean;
min(iterator, context): any;
partition(iterator, context): any[];
pluck(property): any[];
reject(iterator, context): any[];
select(iterator, context): any[];
size(): number;
some(iterator, context): bool;
some(iterator, context): boolean;
sortBy(iterator, context): any[];
toArray(): any[];
zip(args: any[]): any[];
}
}
26 changes: 16 additions & 10 deletions Prototype.d.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/// <reference path="Enumerable.d.ts" />

interface PrototypeBrowser {
Gecko: bool;
IE: bool;
MobileSafari: bool;
Opera: bool;
WebKit: bool;
Gecko: boolean;
IE: boolean;
MobileSafari: boolean;
Opera: boolean;
WebKit: boolean;
}

interface PrototypeBrowserFeatures {
ElementExtensions: bool;
SelectorsAPI: bool;
SpecificElementExtensions: bool;
XPath: bool;
ElementExtensions: boolean;
SelectorsAPI: boolean;
SpecificElementExtensions: boolean;
XPath: boolean;
}

interface PrototypeSelector {
Expand All @@ -22,7 +22,7 @@ interface PrototypeSelector {

find(elements: Element[], expresion, index): Element;

match(element, expresion): bool;
match(element, expresion): boolean;

select(expresion, root): Element[];
}
Expand All @@ -41,3 +41,9 @@ interface Prototype {
}

declare var Prototype: Prototype;

declare class Form {
serialize(div: PrototypeSelector): string;
}

declare function $$(selector: string): HTMLElement[];
7 changes: 7 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "spidgorny/ts-prototype-js-interface",
"description": "Typescript definition for PrototypeJS. Updated.",
"replace": [
"dapuck/TSProtoJSInterface"
]
}
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "TSProtoJSInterface",
"version": "1.0.0"
}
11 changes: 10 additions & 1 deletion test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/// <reference path="Prototype.d.ts" />

import {Ajax} from "./Ajax";
function test () {
if(Prototype.Browser.IE) {
alert("IE");
Expand All @@ -14,4 +15,12 @@ function test () {
} else {
alert("I cannot detect what kind of browser you are using");
}
}
}

class TestJDTS {

ajax() {
Ajax.Updater('me');
}

}