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
| /* Worker Thread */ | |
| var x = 5; | |
| var exec = 'self.port.emit("message", x);' | |
| setTimeout(exec, 1) | |
| /* Main Thread Test */ | |
| Worker({ | |
| contentScript: script, | |
| onAttach: (worker) => { | |
| worker.port.on('message', (val) => { |
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
| { | |
| "./index.js": { | |
| "./utils": "./utils/index.js", | |
| "./dir/a": "./dir/a.js", | |
| "./newmodule": "./newmodule/lib/file.js", | |
| "./dir/b": "./dir/b.js", | |
| "test-math": "./node_modules/test-math/index.js", | |
| "test-custom-main": "./node_modules/test-custom-main/lib/custom-entry.js" | |
| }, | |
| "./dir/b.js": { |
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
| ./b2g/chrome/content/dbg-browser-actors.js:sdk/core/promise | |
| ./browser/base/content/newtab/newTab.js:sdk/core/promise | |
| ./browser/base/content/sanitize.js:sdk/core/promise | |
| ./browser/base/content/test/general/browser_aboutHealthReport.js:sdk/core/promise | |
| ./browser/base/content/test/general/browser_aboutHome.js:sdk/core/promise | |
| ./browser/base/content/test/general/head.js:sdk/core/promise | |
| ./browser/base/content/test/social/head.js:sdk/core/promise | |
| ./browser/components/places/tests/browser/head.js:sdk/core/promise | |
| ./browser/devtools/app-manager/app-projects.js:sdk/core/promise | |
| ./browser/devtools/app-manager/app-validator.js:sdk/core/promise |
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
| # Fish 2.0 config | |
| # Utility functions | |
| function sser --description "Starts a SimpleHTTPServer in the current directory" | |
| if [ (count $argv) = 0 ] | |
| sser 8080 | |
| return | |
| end |
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
| var declare = { | |
| // Transpile src stylus/sass and concatenate with vendor CSS into `dist/build.css` | |
| 'dist/build.css': ['vendor/**/*.css', 'style/*.styl', 'style/*.sass'], | |
| // Transpile src coffeescript and concatenate with vendor JS into temporary pseudofile `$tmpjs.js` | |
| '$tmpjs.js': ['vendor/**/*.js', 'src/*.coffee'], | |
| // Compile handlebar templates into temporary pseudofile `$tmphbs.js` | |
| '$tmphbs.js': 'templates/*.hbs', | |
| // Concatenate our built JS and templates into `dist/build.js` | |
| 'dist/build.js': ['$tmpjs.js', '$tmphbs.js'], | |
| // Also create a minified version |
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
| const pageMod = require("sdk/page-mod"); | |
| const tabs = require("sdk/tabs"); | |
| var mod = pageMod.PageMod({ | |
| include: "*", | |
| contentScript: '(function () { console.log("attached") })();', | |
| onAttach: function(worker) { | |
| if (worker.tab) | |
| console.log('HURRAY'); | |
| console.log(worker.tab); |
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
| function Type (props) { | |
| for (prop in props) | |
| if (props.hasOwnProperty(prop)) | |
| this[prop] = props[prop] | |
| } | |
| Type.prototype.getName = function () { return this.name; } | |
| var data = { | |
| name: "Ted", |
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
| // Doesn't work | |
| subprocess({ | |
| file: 'C:\\Windows\\System32\\cmd.exe', | |
| args: ['/s', '/c', '\"DIR /L\"'] | |
| }) | |
| // Works | |
| subprocess({ | |
| file: 'C:\\Windows\\System32\\cmd.exe', | |
| args: ['/s', '/c', '\"c:\\path\\to\\file.bat\"'] |
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
| $ jpm init | |
| JPM info Running init on undefined | |
| title: (My Jetpack Addon) | |
| name: (my-jetpack) | |
| version: (0.0.0) | |
| Enable node packages? (yes) | |
| description: | |
| entry point: (index.js) | |
| author: | |
| engines (comma separated): (firefox,fennec) |
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
| /* | |
| * CONTENT THREAD | |
| */ | |
| let responses = new Map(); | |
| let listener = ({ id, response }) => { | |
| let callback = responses.get(id); | |
| if (callback) { | |
| responses.delete(id); | |
| callback(response); | |
| } |