Updating to version 1.2.7

This commit is contained in:
Alexey Gorshkov
2016-01-03 01:15:27 +03:00
parent 88b29b7995
commit 14fd30b019
2 changed files with 16 additions and 11 deletions
+10 -6
View File
@@ -1,8 +1,12 @@
/// <reference path="jsurl.d.ts" />
var u = new Url; // curent document URL will be used
interface U2Model {
a: any;
}
var u = new Url <any>(); // curent document URL will be used
// or we can instantiate as
var u2 = new Url("http://example.com/some/path?a=b&c=d#someAnchor");
var u2 = new Url<U2Model>("http://example.com/some/path?a=b&c=d#someAnchor");
// it should support relative URLs also
var u3 = new Url("/my/site/doc/path?foo=bar#baz");
@@ -55,13 +59,13 @@ var str = '<a href="' + u + '">My Cool Link</a>';
// or use in DOM context
var a = document.createElement('a');
a.href = u;
a.href = u.toString();
a.innerHTML = 'test';
document.body.appendChild(a);
// Stringify
u += '';
String(u);
u.toString();
var su1 = u + '';
var su2 = String(u);
var su3 = u.toString();
// NOTE, that usually it will be done automatically, so only in special
// cases direct stringify is required
+6 -5
View File
@@ -1,11 +1,12 @@
// Type definitions for jsurl 1.2.2
// Type definitions for jsurl 1.2.7
// Project: https://github.com/Mikhus/jsurl
// Definitions by: Alexey Gorshkov <https://github.com/agorshkov23>
// Definitions: https://github.com/agorshkov23/DefinitelyTyped
declare class Url {
constructor(url?: string);
query: any;
declare class Url<T> {
constructor();
constructor(url: string);
query: T;
protocol: string;
user: string;
pass: string;
@@ -14,5 +15,5 @@ declare class Url {
path: string;
hash: string;
href: string;
toString(): string;
toString: () => string;
}