comparison src/sceditor.js @ 27:8165b83907af

remove bind()
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 10 Aug 2022 23:48:47 -0600
parents 80bf0adc9efd
children f227fdfebded
comparison
equal deleted inserted replaced
26:160be99e1517 27:8165b83907af
9 * 9 *
10 * @param {string} type 10 * @param {string} type
11 * @param {*} arg 11 * @param {*} arg
12 * @returns {boolean} 12 * @returns {boolean}
13 */ 13 */
14 function isTypeof(type, arg) { 14 function isTypeof(type) {
15 return typeof arg === type; 15 return function(arg) {
16 return typeof arg === type;
17 };
16 } 18 }
17 19
18 /** 20 /**
19 * @type {function(*): boolean} 21 * @type {function(*): boolean}
20 */ 22 */
21 var isString = isTypeof.bind(null, 'string'); 23 var isString = isTypeof('string');
22 24
23 /** 25 /**
24 * @type {function(*): boolean} 26 * @type {function(*): boolean}
25 */ 27 */
26 var isUndefined = isTypeof.bind(null, 'undefined'); 28 var isUndefined = isTypeof('undefined');
27 29
28 /** 30 /**
29 * @type {function(*): boolean} 31 * @type {function(*): boolean}
30 */ 32 */
31 var isFunction = isTypeof.bind(null, 'function'); 33 var isFunction = isTypeof('function');
32 34
33 /** 35 /**
34 * @type {function(*): boolean} 36 * @type {function(*): boolean}
35 */ 37 */
36 var isNumber = isTypeof.bind(null, 'number'); 38 var isNumber = isTypeof('number');
37 39
38 40
39 /** 41 /**
40 * Returns true if an object has no keys 42 * Returns true if an object has no keys
41 * 43 *
2462 editor.closeDropDown(true); 2464 editor.closeDropDown(true);
2463 e.preventDefault(); 2465 e.preventDefault();
2464 } 2466 }
2465 2467
2466 onEvent(content, 'click', '.button', insertUrl); 2468 onEvent(content, 'click', '.button', insertUrl);
2467 onEvent(content, 'keypress', function (target, e) { 2469 onEvent(content, 'keypress', function (e) {
2468 // 13 = enter key 2470 // 13 = enter key
2469 if (e.which === 13 && linkInput.value) { 2471 if (e.which === 13 && linkInput.value) {
2470 insertUrl(e); 2472 insertUrl(e);
2471 } 2473 }
2472 }, EVENT_CAPTURE); 2474 }, EVENT_CAPTURE);