{"action":"created","issue":{"url":"https://api.github.com/repos/filerjs/filer/issues/352","labels_url":"https://api.github.com/repos/filerjs/filer/issues/352/labels{/name}","comments_url":"https://api.github.com/repos/filerjs/filer/issues/352/comments","events_url":"https://api.github.com/repos/filerjs/filer/issues/352/events","html_url":"https://github.com/filerjs/filer/issues/352","id":82443905,"number":352,"title":"Remove Browserify's `process` from built filer, stop process-tick events","user":{"login":"humphd","id":427398,"avatar_url":"https://avatars.githubusercontent.com/u/427398?v=3","gravatar_id":"","url":"https://api.github.com/users/humphd","html_url":"https://github.com/humphd","followers_url":"https://api.github.com/users/humphd/followers","following_url":"https://api.github.com/users/humphd/following{/other_user}","gists_url":"https://api.github.com/users/humphd/gists{/gist_id}","starred_url":"https://api.github.com/users/humphd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/humphd/subscriptions","organizations_url":"https://api.github.com/users/humphd/orgs","repos_url":"https://api.github.com/users/humphd/repos","events_url":"https://api.github.com/users/humphd/events{/privacy}","received_events_url":"https://api.github.com/users/humphd/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-05-29T14:09:23Z","updated_at":"2015-05-29T18:16:27Z","closed_at":null,"body":"Filer floods `postMessage` with `process-tick` events, simulating Node's `nextTick` stuff.  We dont' need it, and it's just there because Browserify is adding it:\r\n\r\n```js\r\n},{\"FWaASH\":10}],10:[function(_dereq_,module,exports){\r\n// shim for using process in browser\r\n\r\nvar process = module.exports = {};\r\n\r\nprocess.nextTick = (function () {\r\n    var canSetImmediate = typeof window !== 'undefined'\r\n    && window.setImmediate;\r\n    var canPost = typeof window !== 'undefined'\r\n    && window.postMessage && window.addEventListener\r\n    ;\r\n\r\n    if (canSetImmediate) {\r\n        return function (f) { return window.setImmediate(f) };\r\n    }\r\n\r\n    if (canPost) {\r\n        var queue = [];\r\n        window.addEventListener('message', function (ev) {\r\n            var source = ev.source;\r\n            if ((source === window || source === null) && ev.data === 'process-tick') {\r\n                ev.stopPropagation();\r\n                if (queue.length > 0) {\r\n                    var fn = queue.shift();\r\n                    fn();\r\n                }\r\n            }\r\n        }, true);\r\n\r\n        return function nextTick(fn) {\r\n            queue.push(fn);\r\n            window.postMessage('process-tick', '*');\r\n        };\r\n    }\r\n\r\n    return function nextTick(fn) {\r\n        setTimeout(fn, 0);\r\n    };\r\n})();\r\n\r\nprocess.title = 'browser';\r\nprocess.browser = true;\r\nprocess.env = {};\r\nprocess.argv = [];\r\n\r\nfunction noop() {}\r\n\r\nprocess.on = noop;\r\nprocess.addListener = noop;\r\nprocess.once = noop;\r\nprocess.off = noop;\r\nprocess.removeListener = noop;\r\nprocess.removeAllListeners = noop;\r\nprocess.emit = noop;\r\n\r\nprocess.binding = function (name) {\r\n    throw new Error('process.binding is not supported');\r\n}\r\n\r\n// TODO(shtylman)\r\nprocess.cwd = function () { return '/' };\r\nprocess.chdir = function (dir) {\r\n    throw new Error('process.chdir is not supported');\r\n};\r\n```\r\nWe need it ripped out of our build step so it doesn't get added to the built filer."},"comment":{"url":"https://api.github.com/repos/filerjs/filer/issues/comments/106894389","html_url":"https://github.com/filerjs/filer/issues/352#issuecomment-106894389","issue_url":"https://api.github.com/repos/filerjs/filer/issues/352","id":106894389,"user":{"login":"sedge","id":1616860,"avatar_url":"https://avatars.githubusercontent.com/u/1616860?v=3","gravatar_id":"","url":"https://api.github.com/users/sedge","html_url":"https://github.com/sedge","followers_url":"https://api.github.com/users/sedge/followers","following_url":"https://api.github.com/users/sedge/following{/other_user}","gists_url":"https://api.github.com/users/sedge/gists{/gist_id}","starred_url":"https://api.github.com/users/sedge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sedge/subscriptions","organizations_url":"https://api.github.com/users/sedge/orgs","repos_url":"https://api.github.com/users/sedge/repos","events_url":"https://api.github.com/users/sedge/events{/privacy}","received_events_url":"https://api.github.com/users/sedge/received_events","type":"User","site_admin":false},"created_at":"2015-05-29T18:16:27Z","updated_at":"2015-05-29T18:16:27Z","body":"The simplest solution (on the surface) is to  to remove or replace the `minimap` module. That's where the `process` global reference is that's causing browserify to pull the process shim into the build. Ironically, it's a `typeof` statement, which handles undefined just fine. \r\n\r\nThe alternative is for me to switch the filer build step away from using `grunt-browserify`, preferring a `grunt-exec` call with command line parameters. They seem to be far more customizable than the programatic API browserify provides.\r\n\r\nThe docs suck though, so I might just be missing something. I spent about 3 hours trying to figure out how to specify the globals we want defined programatically without much luck.\r\n\r\n"}}