Skip to content

Commit

Permalink
Bumped version to 4.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiospampinato committed May 12, 2019
1 parent 612635a commit 370718c
Show file tree
Hide file tree
Showing 8 changed files with 397 additions and 301 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
### Version 4.1.0
- Added $.isWindow
- Made the TypeScript type system stricter
- $.guid: ensuring it’s properly exported
- $.fn.siblings: ensuring it supports multi-element collections
- $.fn.empty: ensuring it supports multi-element collections
- $.fn.attr: doing nothing when the value equals undefined

### Version 4.0.0
- Removed `$.fn.removeData`
- Removed `$.hasData`
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ If you're migrating from jQuery be sure to read our [migration guide](https://gi

## Usage

Get Cash from [CloudFlare](https://cdnjs.cloudflare.com/ajax/libs/cash/4.0.0/cash.min.js) or [jsDelivr](https://cdn.jsdelivr.net/npm/cash-dom@4.0.0/dist/cash.min.js) and use it like this:
Get Cash from [CloudFlare](https://cdnjs.cloudflare.com/ajax/libs/cash/4.1.0/cash.min.js) or [jsDelivr](https://cdn.jsdelivr.net/npm/cash-dom@4.1.0/dist/cash.min.js) and use it like this:

```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/cash/4.0.0/cash.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/cash/4.1.0/cash.min.js"></script>
<script>
$(function () {
$('html').addClass ( 'dom-loaded' );
Expand Down
61 changes: 37 additions & 24 deletions dist/cash.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
interface Cash {
[index: number]: Window & Document & HTMLElement & Element & Node;
[index: number]: Ele;
length: number;
splice(start: number, deleteCount?: number): any;
splice(start: number, deleteCount: number, ...items: Ele[]): any;
splice(start: number, deleteCount?: number): Ele[];
splice(start: number, deleteCount: number, ...items: Ele[]): Ele[];
}
interface CashStatic {
fn: Cash;
Expand All @@ -12,9 +12,18 @@ declare type plainObject = {
};
declare type falsy = undefined | null | false | 0 | '';
declare type Ele = Window | Document | HTMLElement | Element | Node;
declare type Selector = falsy | string | Function | HTMLCollection | NodeList | Ele | Ele[] | ArrayLike<any> | Cash;
declare type Comparator = string | Function | Ele | Cash;
declare type Selector = falsy | string | Function | HTMLCollection | NodeList | Ele | Ele[] | ArrayLike<Ele> | Cash;
declare type Comparator = string | Ele | Cash | ((this: Ele, index: number, ele: Ele) => boolean);
declare type Context = Document | HTMLElement | Element;
declare type EventObj = Event & {
__delegate?: boolean;
namespace?: string;
data?: any;
};
declare type EventCallback = {
(event: EventObj, data?: any): any;
guid?: number;
};
declare class Cash {
constructor(selector?: Selector, context?: Context | Cash);
init(selector?: Selector, context?: Context | Cash): Cash;
Expand All @@ -33,20 +42,22 @@ interface Cash {
interface Cash {
last(): Cash;
}
declare type MapCallback<T> = (this: T, index: number, ele: T) => Ele;
interface Cash {
map(callback: Function): Cash;
map(callback: MapCallback<Ele>): Cash;
}
interface Cash {
slice(start?: number, end?: number): Cash;
}
interface CashStatic {
camelCase(str: string): string;
}
declare type EachCallback<T> = (this: T, index: number, ele: T) => any;
interface CashStatic {
each(arr: ArrayLike<any>, callback: Function): void;
each<T>(arr: ArrayLike<T>, callback: EachCallback<T>): void;
}
interface Cash {
each(callback: Function): this;
each(callback: EachCallback<Ele>): this;
}
interface Cash {
removeProp(prop: string): this;
Expand All @@ -61,9 +72,10 @@ interface CashStatic {
guid: number;
}
interface CashStatic {
matches(ele: HTMLElement, selector: string): boolean;
matches(ele: any, selector: string): boolean;
}
interface CashStatic {
isWindow(x: any): x is Window;
isFunction(x: any): x is Function;
isString(x: any): x is string;
isNumeric(x: any): boolean;
Expand All @@ -84,8 +96,9 @@ interface Cash {
removeAttr(attrs: string): this;
}
interface Cash {
attr(attrs: string): any;
attr(attrs: string, value: any): this;
attr(): undefined;
attr(attrs: string): string | null;
attr(attrs: string, value: string): this;
attr(attrs: plainObject): this;
}
interface Cash {
Expand All @@ -98,7 +111,7 @@ interface Cash {
removeClass(classes?: string): this;
}
interface CashStatic {
unique(arr: ArrayLike<any>): ArrayLike<any>;
unique<T>(arr: ArrayLike<T>): ArrayLike<T>;
}
interface Cash {
add(selector: Selector, context?: Context): Cash;
Expand All @@ -107,8 +120,8 @@ interface CashStatic {
prefixedProp(prop: string, isVariable?: boolean): string;
}
interface Cash {
css(prop: string): any;
css(prop: string, value: any): this;
css(prop: string): string | undefined;
css(prop: string, value: string): this;
css(props: plainObject): this;
}
interface Cash {
Expand All @@ -118,8 +131,8 @@ interface Cash {
data(datas: plainObject): this;
}
interface Cash {
innerWidth(): number;
innerHeight(): number;
innerWidth(): number | undefined;
innerHeight(): number | undefined;
}
interface Cash {
width(): number;
Expand All @@ -143,31 +156,31 @@ interface Cash {
interface Cash {
off(): this;
off(events: string): this;
off(events: string, callback: Function): this;
off(events: string, selector: string, callback: Function): this;
off(events: string, callback: EventCallback): this;
off(events: string, selector: string, callback: EventCallback): this;
}
interface Cash {
on(events: plainObject): this;
on(events: string, callback: Function, _one?: boolean): this;
on(events: string, selector: string | Function, callback: Function, _one?: boolean): this;
on(events: string, callback: EventCallback, _one?: boolean): this;
on(events: string, selector: string | EventCallback, callback: EventCallback, _one?: boolean): this;
}
interface Cash {
one(events: plainObject): this;
one(events: string, callback: Function): this;
one(events: string, selector: string | Function, callback: Function): this;
one(events: string, callback: EventCallback): this;
one(events: string, selector: string | EventCallback, callback: EventCallback): this;
}
interface Cash {
ready(callback: Function): this;
}
interface Cash {
trigger(event: string | Event, data?: any): this;
trigger(event: Event | string, data?: any): this;
}
interface Cash {
serialize(): string;
}
interface Cash {
val(): string | string[];
val(value: any): this;
val(value: string | string[]): this;
}
interface Cash {
clone(): this;
Expand Down
Loading

0 comments on commit 370718c

Please sign in to comment.