Created
October 14, 2014 03:04
-
-
Save ironfroggy/0776889a073318446b10 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
| # |
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
| WindowManager.createWindow(); | |
| document.write('<input id="a" />'); | |
| document.write('<span> + </span>'); | |
| document.write('<input id="b" />'); | |
| document.write('<span> = </span>'); | |
| document.write('<input id="c" />'); | |
| function update() { | |
| var a = $('#a').val(); | |
| var b = $('#b').val(); | |
| $('#c').val(Calculator.add(a, b)); | |
| }; | |
| $('#a').keyup(update).focus(); | |
| $('#b').keyup(update); | |
| $('#c').focus(function() { $('#a').focus(); }); |
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
| from trapdoor.extension import Extension | |
| __all__ = ['Calculator'] | |
| class Calculator(Extension): | |
| @Extension.method(int, int) | |
| @Extension.returns(int) | |
| def add(self, a, b): | |
| self._result = a + b |
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
| extensions: | |
| - calculator.Calculator | |
| js: | |
| - calculator.js | |
| plugins: | |
| - trapdoor.contrib.windowmanager |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment