-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathextension.js
31 lines (29 loc) · 1.14 KB
/
extension.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
var fs = require('fs'),
pjson = require('./package.json'),
Extension = require('openframe-extension');
/**
* Extension initialization method.
*
* Called when the extension (and its dependencies) have been installed.
*
* @param {object} OF An interface provided to extensions giving limited access to the frame environment
*/
module.exports = new Extension({
format: {
// the name should be the same as the package name
'name': pjson.name,
// this is what might get displayed to users
'display_name': 'openFrameworks',
// does this type of artwork need to be downloaded to the frame?
'download': true,
// how do start this type of artwork? currently two token replacements, $filepath and $url
'start_command': function(args, tokens) {
// make sure the file is executable
fs.chmodSync(tokens.$filepath, 0755);
// start command just executes the file ($filepath is absolute, includes leading slash)
return '$filepath';
},
// how do we stop this type of artwork?
'end_command': 'sudo pkill -f $filename'
}
});