@ouroboros/browser 0.5.1 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -8
- package/devices.d.ts +23 -0
- package/devices.js +24 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/ouroboros-browser-0.5.3.tgz +0 -0
- package/package.json +6 -6
- package/src/devices.ts +26 -0
- package/src/index.ts +1 -0
package/README.md
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
# @ouroboros/browser
|
|
2
|
-
|
|
3
2
|
[](https://www.npmjs.com/package/@ouroboros/browser) 
|
|
4
3
|
|
|
5
4
|
A library of classes to manage functionality in browsers.
|
|
@@ -24,7 +23,7 @@ or
|
|
|
24
23
|
import { clipboard } from '@ouroboros/browser';
|
|
25
24
|
```
|
|
26
25
|
|
|
27
|
-
copy()
|
|
26
|
+
`clipboard.copy()`
|
|
28
27
|
|
|
29
28
|
## cookies
|
|
30
29
|
|
|
@@ -40,7 +39,23 @@ or
|
|
|
40
39
|
import { cookies } from '@ouroboros/browser';
|
|
41
40
|
```
|
|
42
41
|
|
|
43
|
-
get()
|
|
42
|
+
`get()`, `remove()`, `set()`
|
|
43
|
+
|
|
44
|
+
## devices
|
|
45
|
+
|
|
46
|
+
Import Devices into your code
|
|
47
|
+
|
|
48
|
+
```javascript
|
|
49
|
+
import devices, { hasPointer } from '@ouroboros/browser/devices';
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
or
|
|
53
|
+
|
|
54
|
+
```javascript
|
|
55
|
+
import { devices } from '@ouroboros/browser';
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
`devices.hasPointer()`
|
|
44
59
|
|
|
45
60
|
## hash
|
|
46
61
|
|
|
@@ -56,7 +71,7 @@ or
|
|
|
56
71
|
import { hash } from '@ouroboros/browser';
|
|
57
72
|
```
|
|
58
73
|
|
|
59
|
-
get()
|
|
74
|
+
`hash.get()`, `hash.set()`, `hash.subscribe()`, `hash.unsubscribe()`
|
|
60
75
|
|
|
61
76
|
## network
|
|
62
77
|
|
|
@@ -72,7 +87,7 @@ or
|
|
|
72
87
|
import { network } from '@ouroboros/browser';
|
|
73
88
|
```
|
|
74
89
|
|
|
75
|
-
default (Subscribe)
|
|
90
|
+
default (`Subscribe`)
|
|
76
91
|
|
|
77
92
|
## pageVisibility
|
|
78
93
|
|
|
@@ -88,7 +103,7 @@ or
|
|
|
88
103
|
import { pageVisibility } from '@ouroboros/browser';
|
|
89
104
|
```
|
|
90
105
|
|
|
91
|
-
default (Subscribe)
|
|
106
|
+
default (`Subscribe`)
|
|
92
107
|
|
|
93
108
|
## safeLocalStorage
|
|
94
109
|
|
|
@@ -104,7 +119,7 @@ or
|
|
|
104
119
|
import { safeLocalStorage } from '@ouroboros/browser';
|
|
105
120
|
```
|
|
106
121
|
|
|
107
|
-
bool()
|
|
122
|
+
`safeLocalStorage.bool()`, `safeLocalStorage.json()`, `safeLocalStorage.string()`
|
|
108
123
|
|
|
109
124
|
## size
|
|
110
125
|
|
|
@@ -120,4 +135,4 @@ or
|
|
|
120
135
|
import { size } from '@ouroboros/browser';
|
|
121
136
|
```
|
|
122
137
|
|
|
123
|
-
|
|
138
|
+
default (`Subscribe`), `size.compare()`, `size.greaterThan()`, `size.lessThan()`
|
package/devices.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Device
|
|
3
|
+
*
|
|
4
|
+
* Functions for getting device information
|
|
5
|
+
*
|
|
6
|
+
* @author Chris Nasr <chris@ouroboroscoding.com>
|
|
7
|
+
* @copyright Ouroboros Coding Inc.
|
|
8
|
+
* @created 2025-04-16
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Has Pointer
|
|
12
|
+
*
|
|
13
|
+
* Returns true only if the device has some sort of pointer device like a mouse.
|
|
14
|
+
*
|
|
15
|
+
* @name hasPointer
|
|
16
|
+
* @access public
|
|
17
|
+
* @returns bool
|
|
18
|
+
*/
|
|
19
|
+
export declare function hasPointer(): boolean;
|
|
20
|
+
declare const devices: {
|
|
21
|
+
hasPointer: typeof hasPointer;
|
|
22
|
+
};
|
|
23
|
+
export default devices;
|
package/devices.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Device
|
|
3
|
+
*
|
|
4
|
+
* Functions for getting device information
|
|
5
|
+
*
|
|
6
|
+
* @author Chris Nasr <chris@ouroboroscoding.com>
|
|
7
|
+
* @copyright Ouroboros Coding Inc.
|
|
8
|
+
* @created 2025-04-16
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Has Pointer
|
|
12
|
+
*
|
|
13
|
+
* Returns true only if the device has some sort of pointer device like a mouse.
|
|
14
|
+
*
|
|
15
|
+
* @name hasPointer
|
|
16
|
+
* @access public
|
|
17
|
+
* @returns bool
|
|
18
|
+
*/
|
|
19
|
+
export function hasPointer() {
|
|
20
|
+
return window.matchMedia("(any-hover: hover)").matches;
|
|
21
|
+
}
|
|
22
|
+
// Default export
|
|
23
|
+
const devices = { hasPointer };
|
|
24
|
+
export default devices;
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { default as clipboard } from './clipboard';
|
|
2
2
|
export { default as cookies } from './cookies';
|
|
3
|
+
export { default as devices } from './devices';
|
|
3
4
|
export { default as hash } from './hash';
|
|
4
5
|
export { default as network } from './network';
|
|
5
6
|
export { default as pageVisibility } from './pageVisibility';
|
package/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { default as clipboard } from './clipboard';
|
|
2
2
|
export { default as cookies } from './cookies';
|
|
3
|
+
export { default as devices } from './devices';
|
|
3
4
|
export { default as hash } from './hash';
|
|
4
5
|
export { default as network } from './network';
|
|
5
6
|
export { default as pageVisibility } from './pageVisibility';
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ouroboros/browser",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"description": "Package to handle common browser functionality.",
|
|
5
|
-
"main": "
|
|
6
|
-
"types": "
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"types": "index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "tslint -p tsconfig.json && tsc",
|
|
9
|
-
"clean": "rm
|
|
9
|
+
"clean": "rm *.js *.d.ts",
|
|
10
10
|
"for_local": "npm install; tslint -p tsconfig.json && tsc; rm -Rf node_modules",
|
|
11
11
|
"test": "echo \"Error: no test specified.\" && exit 1"
|
|
12
12
|
},
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@ouroboros/clone": "^1.1.0",
|
|
40
|
-
"@ouroboros/subscribe": "^1.3.
|
|
41
|
-
"@ouroboros/tools": "^0.
|
|
40
|
+
"@ouroboros/subscribe": "^1.3.2",
|
|
41
|
+
"@ouroboros/tools": "^0.7.1"
|
|
42
42
|
}
|
|
43
43
|
}
|
package/src/devices.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Device
|
|
3
|
+
*
|
|
4
|
+
* Functions for getting device information
|
|
5
|
+
*
|
|
6
|
+
* @author Chris Nasr <chris@ouroboroscoding.com>
|
|
7
|
+
* @copyright Ouroboros Coding Inc.
|
|
8
|
+
* @created 2025-04-16
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Has Pointer
|
|
13
|
+
*
|
|
14
|
+
* Returns true only if the device has some sort of pointer device like a mouse.
|
|
15
|
+
*
|
|
16
|
+
* @name hasPointer
|
|
17
|
+
* @access public
|
|
18
|
+
* @returns bool
|
|
19
|
+
*/
|
|
20
|
+
export function hasPointer(): boolean {
|
|
21
|
+
return window.matchMedia("(any-hover: hover)").matches
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Default export
|
|
25
|
+
const devices = { hasPointer }
|
|
26
|
+
export default devices;
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { default as clipboard } from './clipboard';
|
|
2
2
|
export { default as cookies } from './cookies';
|
|
3
|
+
export { default as devices } from './devices';
|
|
3
4
|
export { default as hash } from './hash';
|
|
4
5
|
export { default as network } from './network';
|
|
5
6
|
export { default as pageVisibility } from './pageVisibility';
|