@bbn/bbn 1.0.272 → 1.0.273
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/dist/bbn.js +1 -1
- package/dist/bbn.js.map +1 -1
- package/dist/fn/init.js +5 -3
- package/package.json +1 -1
package/dist/fn/init.js
CHANGED
|
@@ -9,6 +9,7 @@ import isMobile from './browser/isMobile.js';
|
|
|
9
9
|
import isTabletDevice from './browser/isTabletDevice.js';
|
|
10
10
|
import isFunction from './type/isFunction.js';
|
|
11
11
|
import log from './browser/log.js';
|
|
12
|
+
import timestamp from './datetime/timestamp.js';
|
|
12
13
|
/**
|
|
13
14
|
* Initializes the library bbn basing on the given configuration object.
|
|
14
15
|
* - Gives to the environment the dimension of the window.innerWidth and window.innerHeight
|
|
@@ -94,11 +95,12 @@ export default function init(cfg, force) {
|
|
|
94
95
|
}
|
|
95
96
|
window.onfocus = function () {
|
|
96
97
|
bbn.env.isFocused = true;
|
|
98
|
+
bbn.env.last_focus = timestamp();
|
|
97
99
|
bbn.fn.defaultWindowFocusFunction();
|
|
98
100
|
};
|
|
99
101
|
window.onblur = function () {
|
|
100
102
|
bbn.env.isFocused = false;
|
|
101
|
-
bbn.env.timeoff = Math.round(
|
|
103
|
+
bbn.env.timeoff = Math.round(timestamp() / 1000);
|
|
102
104
|
bbn.fn.defaultWindowBlurFunction();
|
|
103
105
|
};
|
|
104
106
|
document.addEventListener("focusin", function (e) {
|
|
@@ -106,10 +108,10 @@ export default function init(cfg, force) {
|
|
|
106
108
|
!e.target.classList.contains("bbn-no")) {
|
|
107
109
|
bbn.env.focused = e.target;
|
|
108
110
|
}
|
|
109
|
-
bbn.env.last_focus =
|
|
111
|
+
bbn.env.last_focus = timestamp();
|
|
110
112
|
});
|
|
111
113
|
document.addEventListener("click", function (e) {
|
|
112
|
-
bbn.env.last_focus =
|
|
114
|
+
bbn.env.last_focus = timestamp();
|
|
113
115
|
if (bbn.env.nav !== "ajax") {
|
|
114
116
|
return;
|
|
115
117
|
}
|