Last active
February 15, 2016 20:08
-
-
Save jackaperkins/e019227cbc49b3386b1e to your computer and use it in GitHub Desktop.
plugin format
This file contains 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
// our plugin data that comes back from the plugin API | |
var plugin = { | |
name: "jacks cool script", | |
body: "var p ={actionName: \"orderPizza\", action: function () { var x = 1;}}" | |
} | |
// body is a string of raw javascript code, not JSON encoded; | |
// when we call eval on it, it'll create a local variable which we can then use: | |
var p = { | |
actionName: "orderPizza", | |
action: function () { | |
var $pizza = new PizzaAPI(); | |
$Pizza.order(); // ... custom code | |
}, | |
command: "order (me a) pizza" | |
} | |
// inside aubrey's plugin loading: | |
eval(plugin.body); | |
addPlugin(p); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment