forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
match-media.d.ts
30 lines (23 loc) · 1.52 KB
/
match-media.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Type definitions for Angular matchMedia 0.6.0 (angular.matchMedia module)
// Project: https://github.com/jacopotarantino/angular-match-media
// Definitions by: Joao Monteiro <https://github.com/jpmnteiro>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../angularjs/angular.d.ts" />
declare namespace angular.matchmedia {
interface IScreenSize {
// Returns a value indicating if the current device has a retina screen
isRetina: boolean;
is(list: Array<string> | string): boolean;
// Executes the callback function on window resize with the match truthiness as the first argument.
// Returns the current match truthiness.
// The 'scope' parameter is optional. If it's not passed in, '$rootScope' is used.
on(list: Array<string> | string, callback: (result: boolean) => void, scope?: angular.IScope): boolean;
// Executes the callback function ONLY when the match differs from previous match.
// Returns the current match truthiness.
// The 'scope' parameter is required for cleanup reasons (destroy event).
onChange(scope: angular.IScope, list: Array<string> | string, callback: (result: boolean) => void): boolean;
// Executes the callback only when inside of the particular screensize.
// The 'scope' parameter is optional. If it's not passed in, '$rootScope' is used.
when(list: Array<string> | string, callback: (result: boolean) => void, scope?: angular.IScope): boolean;
}
}