Created
June 22, 2009 16:50
-
-
Save subtleGradient/134072 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var btn = new Element('button',{html:'Run'}).addEvent('click', Context('dynamic').handleWith('handleClick')); | |
Ccontext(1).addHandler('handleClick', function(){alert(1);}); | |
Ccontext(2).addHandler('handleClick', function(){alert(2);}); | |
Context.set(1); | |
Context('dynamic') === Context(1); | |
btn.fireEvent('click'); // alert(1) | |
Context.set(2); | |
Context('dynamic') === Context(2); | |
btn.fireEvent('click'); // alert(2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// # -- sequential speccing | |
spec.group('id', 'description'); | |
spec.add('some description', function(){}); | |
spec.add('some other description', function(){}); | |
spec.group('id2', 'description2'); | |
spec.add('some description', function(){}); | |
spec.add('some other description', function(){}); | |
spec.run(); //starts every group | |
spec.run('id'); //starts the group id | |
spec.run('id', 'id2'); //starts the group id and id2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment