ENGAGE-534: Refactor the public api, removing unnecessary and dangerous functions

Metadata

Source
ENGAGE-534
Type
Task
Priority
Major
Status
Closed
Resolution
Fixed
Assignee
Antranig Basman
Reporter
Justin Obara
Created
2010-03-25T10:47:45.000-0400
Updated
2014-03-03T13:44:00.309-0500
Versions
  1. 0.3
Fixed Versions
  1. 0.3
Component
  1. Cabinet

Description

Refactor the public api, removing unnecessary and dangerous functions

The toggle function can lead to a confused state of the drawers.

The close and open functions should be distilled into a single adjust function that takes constants refering to the open and closing of drawers.

Comments

  • Justin Obara commented 2010-03-25T13:18:54.000-0400

    There is now only one movement function, positionDrawers. The toggle function remains in the code, but is not accessible publicly. It is still used internally.

  • Justin Obara commented 2010-03-25T13:19:11.000-0400

    Assigned to Antranig for review

  • Antranig Basman commented 2010-03-25T17:18:47.000-0400

    The "toggle" function is just as dangerous and wasteful in private code (if not more so the latter 😛) than in public. It should be removed entirely, and replaced with two separate utilities, one to read the current state of a drawer from the DOM (embodying the elm.hasClass branch) and another to write it. In addition, the open/close utilities should simply be folded into the "position" method. Also the current implementation is broken - the "position" method called from that.positionDrawers calls through to a method which is actually named "drawerAdjust". Please supply test cases for new functionality in future 🙂

  • Antranig Basman commented 2010-03-25T17:19:16.000-0400

    Apologies - looks like there are functioning test cases for the new functionality - however, I suggest it would be a clearer implementation if the positional arguments were strings, and the toggle, open and close methods were removed.

  • Justin Obara commented 2010-03-26T12:23:15.000-0400

    Refactored public api again. There are now functions to setDrawers and getDrawerState.

  • Justin Obara commented 2010-03-26T12:23:28.000-0400

    assigned to Antranig for review