Labs/Bespin/Commands/Calculate

From MozillaWiki
< Labs‎ | Bespin‎ | Commands
Jump to: navigation, search

Dion Almaer has this simple little silly calculator:

 {
   name: 'calculate',
   takes: ['expr'],
   preview: 'calculate some simple math',
   execute: function(self, expr) {
     if (!expr) {
       self.showInfo('Please give me something to calculate dood!');
     } else {
       self.showInfo('Calculating ' + expr + '

Result: ' + eval(expr)); } } }