@bbn/bbn 1.0.272 → 1.0.274
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 +7 -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,22 +95,25 @@ 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();
|
|
100
|
+
bbn.fn.log("FOCUSING ON WINDOW");
|
|
98
101
|
};
|
|
99
102
|
window.onblur = function () {
|
|
100
103
|
bbn.env.isFocused = false;
|
|
101
|
-
bbn.env.timeoff = Math.round(
|
|
104
|
+
bbn.env.timeoff = Math.round(timestamp() / 1000);
|
|
102
105
|
bbn.fn.defaultWindowBlurFunction();
|
|
106
|
+
bbn.fn.log("BLURING ON WINDOW");
|
|
103
107
|
};
|
|
104
108
|
document.addEventListener("focusin", function (e) {
|
|
105
109
|
if (e.target instanceof HTMLElement &&
|
|
106
110
|
!e.target.classList.contains("bbn-no")) {
|
|
107
111
|
bbn.env.focused = e.target;
|
|
108
112
|
}
|
|
109
|
-
bbn.env.last_focus =
|
|
113
|
+
bbn.env.last_focus = timestamp();
|
|
110
114
|
});
|
|
111
115
|
document.addEventListener("click", function (e) {
|
|
112
|
-
bbn.env.last_focus =
|
|
116
|
+
bbn.env.last_focus = timestamp();
|
|
113
117
|
if (bbn.env.nav !== "ajax") {
|
|
114
118
|
return;
|
|
115
119
|
}
|