Labs/Bespin/Commands/Calculate: Difference between revisions

From MozillaWiki
< Labs‎ | Bespin‎ | Commands
Jump to navigation Jump to search
(New page: Dion Almaer has this simple little silly calculator: { name: 'calculate', takes: ['expr'], preview: 'calculate some simple math', execute: function(self, expr) { i...)
 
(No difference)

Latest revision as of 19:47, 27 February 2009

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)); } } }