@bbn/bbn 1.0.271 → 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.
@@ -0,0 +1 @@
1
+ export default function defaultWindowBlurFunction(): boolean;
@@ -0,0 +1,4 @@
1
+ export default function defaultWindowBlurFunction() {
2
+ return true;
3
+ }
4
+ ;
@@ -0,0 +1 @@
1
+ export default function defaultWindowFocusFunction(): boolean;
@@ -0,0 +1,4 @@
1
+ export default function defaultWindowFocusFunction() {
2
+ return true;
3
+ }
4
+ ;
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,20 +95,23 @@ 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();
99
+ bbn.fn.defaultWindowFocusFunction();
97
100
  };
98
101
  window.onblur = function () {
99
102
  bbn.env.isFocused = false;
100
- bbn.env.timeoff = Math.round(new Date().getTime() / 1000);
103
+ bbn.env.timeoff = Math.round(timestamp() / 1000);
104
+ bbn.fn.defaultWindowBlurFunction();
101
105
  };
102
106
  document.addEventListener("focusin", function (e) {
103
107
  if (e.target instanceof HTMLElement &&
104
108
  !e.target.classList.contains("bbn-no")) {
105
109
  bbn.env.focused = e.target;
106
110
  }
107
- bbn.env.last_focus = new Date().getTime();
111
+ bbn.env.last_focus = timestamp();
108
112
  });
109
113
  document.addEventListener("click", function (e) {
110
- bbn.env.last_focus = new Date().getTime();
114
+ bbn.env.last_focus = timestamp();
111
115
  if (bbn.env.nav !== "ajax") {
112
116
  return;
113
117
  }
package/dist/fn.d.ts CHANGED
@@ -54,6 +54,8 @@ import defaultPostLinkFunction from './fn/default/defaultPostLinkFunction.js';
54
54
  import defaultPreLinkFunction from './fn/default/defaultPreLinkFunction.js';
55
55
  import defaultResizeFunction from './fn/default/defaultResizeFunction.js';
56
56
  import defaultStartLoadingFunction from './fn/default/defaultStartLoadingFunction.js';
57
+ import defaultWindowBlurFunction from './fn/default/defaultWindowBlurFunction.js';
58
+ import defaultWindowFocusFunction from './fn/default/defaultWindowFocusFunction.js';
57
59
  import deleteProp from './fn/object/deleteProp.js';
58
60
  import diffObj from './fn/object/diffObj.js';
59
61
  import dirName from './fn/string/dirName.js';
@@ -290,6 +292,8 @@ declare const _default: {
290
292
  defaultPreLinkFunction: typeof defaultPreLinkFunction;
291
293
  defaultResizeFunction: typeof defaultResizeFunction;
292
294
  defaultStartLoadingFunction: typeof defaultStartLoadingFunction;
295
+ defaultWindowBlurFunction: typeof defaultWindowBlurFunction;
296
+ defaultWindowFocusFunction: typeof defaultWindowFocusFunction;
293
297
  deleteProp: typeof deleteProp;
294
298
  diffObj: typeof diffObj;
295
299
  dirName: typeof dirName;
package/dist/fn.js CHANGED
@@ -54,6 +54,8 @@ import defaultPostLinkFunction from './fn/default/defaultPostLinkFunction.js';
54
54
  import defaultPreLinkFunction from './fn/default/defaultPreLinkFunction.js';
55
55
  import defaultResizeFunction from './fn/default/defaultResizeFunction.js';
56
56
  import defaultStartLoadingFunction from './fn/default/defaultStartLoadingFunction.js';
57
+ import defaultWindowBlurFunction from './fn/default/defaultWindowBlurFunction.js';
58
+ import defaultWindowFocusFunction from './fn/default/defaultWindowFocusFunction.js';
57
59
  import deleteProp from './fn/object/deleteProp.js';
58
60
  import diffObj from './fn/object/diffObj.js';
59
61
  import dirName from './fn/string/dirName.js';
@@ -290,6 +292,8 @@ export default {
290
292
  defaultPreLinkFunction: defaultPreLinkFunction,
291
293
  defaultResizeFunction: defaultResizeFunction,
292
294
  defaultStartLoadingFunction: defaultStartLoadingFunction,
295
+ defaultWindowBlurFunction: defaultWindowBlurFunction,
296
+ defaultWindowFocusFunction: defaultWindowFocusFunction,
293
297
  deleteProp: deleteProp,
294
298
  diffObj: diffObj,
295
299
  dirName: dirName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbn/bbn",
3
- "version": "1.0.271",
3
+ "version": "1.0.273",
4
4
  "description": "Javascript toolkit",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",