1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-03-27 00:13:30 +01:00

Simplify some overwrought optional arg handling in StatusLine updaters.

--HG--
extra : rebase_source : 08270edb93ef96cb00d8b16239ff29d61f2299cb
This commit is contained in:
Doug Kearns
2010-11-05 18:36:12 +11:00
parent 903268b0e1
commit 81fb98b4c4
2 changed files with 11 additions and 7 deletions

View File

@@ -152,9 +152,10 @@ const StatusLine = Module("statusline", {
* along with multi-key mappings. * along with multi-key mappings.
* *
* @param {string} buffer * @param {string} buffer
* @optional
*/ */
updateInputBuffer: function updateInputBuffer(buffer) { updateInputBuffer: function updateInputBuffer(buffer) {
if (!buffer || typeof buffer != "string") if (buffer == null)
buffer = ""; buffer = "";
this.widgets.inputbuffer.value = buffer; this.widgets.inputbuffer.value = buffer;
@@ -199,10 +200,10 @@ const StatusLine = Module("statusline", {
/** /**
* Display the correct tabcount (e.g., [1/5]) on the status bar. * Display the correct tabcount (e.g., [1/5]) on the status bar.
* *
* @param {bool} delayed When true, update count after a * @param {boolean} delayed When true, update count after a brief timeout.
* brief timeout. Useful in the many cases when an * Useful in the many cases when an event that triggers an update is
* event that triggers an update is broadcast before * broadcast before the tab state is fully updated.
* the tab state is fully updated. * @optional
*/ */
updateTabCount: function updateTabCount(delayed) { updateTabCount: function updateTabCount(delayed) {
if (dactyl.has("tabs")) { if (dactyl.has("tabs")) {
@@ -224,10 +225,11 @@ const StatusLine = Module("statusline", {
* Display the main content's vertical scroll position in the status * Display the main content's vertical scroll position in the status
* bar. * bar.
* *
* @param {number} percent The position, as a percentage. @optional * @param {number} percent The position, as a percentage.
* @optional
*/ */
updateBufferPosition: function updateBufferPosition(percent) { updateBufferPosition: function updateBufferPosition(percent) {
if (typeof percent != "number") { if (percent == null) {
let win = document.commandDispatcher.focusedWindow; let win = document.commandDispatcher.focusedWindow;
if (!win) if (!win)
return; return;

View File

@@ -11,6 +11,8 @@ ARCHITECTURE:
Unfortunately, nearly all of the parsers are lacking in some way, bloated to Unfortunately, nearly all of the parsers are lacking in some way, bloated to
hell, and/or lack support for JS 1.8. --Kris hell, and/or lack support for JS 1.8. --Kris
- unify the disgusting hodge podge of contract specification styles
REFACTORING: REFACTORING:
- remove unnecessary usage of "self" - remove unnecessary usage of "self"