rse / componentjs

ComponentJS -- Powerful run-time Component System for structuring HTML5-based Rich Clients
http://componentjs.com/
Other
85 stars 13 forks source link

Automatically unspool life-cycle state named spools #25

Closed AuspeXeu closed 11 years ago

AuspeXeu commented 11 years ago

This patch checks the availability of a spool named like the leaving state, directly after the leave life-cycle method was performed. If a spool is found, then it is automatically unspooled.

Cleaned up the variable usage so that less object lookups are needed

AuspeXeu commented 11 years ago

After a little inspection of the ominous lines:

name = "ComponentJS:state:" + _cs.states[comp.__state + 1].state + ":leave";
if (comp.spooled(name))
    comp.unspool(name);

and

name = "ComponentJS:state:" + _cs.states[comp.__state].state + ":enter";
if (comp.spooled(name))
    comp.unspool(name);

I found out, that these lines are not for internal use and are thus for the developer. But as the names are rather cumbersome, I think the pull request can be merged and the lines can be removed. (Btw: I think the position was already a little bit strange, as the unspool would ve been performed even in the /* FULL STOP: state leave method rejected state transition */ case)

I updated the pullrequest in that way.

rse commented 11 years ago

Now taken over in slightly modified variant: https://github.com/rse/componentjs/commit/1ac0cd587c883d0541ae4ae6eb033b8f1ae29a9c