forked from iyay/react-mini-router
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreact-mini-router.js
892 lines (724 loc) · 23.5 KB
/
react-mini-router.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
/*! ReactMiniRouter 1.1.7 - https://github.com/larrymyers/react-mini-router */
var ReactMiniRouter =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {
module.exports = {
RouterMixin: __webpack_require__(1),
navigate: __webpack_require__(2)
};
/***/ },
/* 1 */
/***/ function(module, exports, __webpack_require__) {
var React = __webpack_require__(3),
EventListener = __webpack_require__(7),
getEventTarget = __webpack_require__(8),
pathToRegexp = __webpack_require__(6),
urllite = __webpack_require__(9),
detect = __webpack_require__(4);
var PropValidation = {
path: React.PropTypes.string,
root: React.PropTypes.string,
useHistory: React.PropTypes.bool
};
module.exports = {
propTypes: PropValidation,
contextTypes: PropValidation,
childContextTypes: PropValidation,
getChildContext: function() {
return {
path: this.state.path,
root: this.state.root,
useHistory: this.state.useHistory
}
},
getDefaultProps: function() {
return {
routes: {}
};
},
getInitialState: function() {
return {
path: getInitialPath(this),
root: this.props.root || this.context.path || '',
useHistory: (this.props.history || this.context.useHistory) && detect.hasPushState
};
},
componentWillMount: function() {
this.setState({ _routes: processRoutes(this.state.root, this.routes, this) });
},
componentDidMount: function() {
var _events = this._events = [];
_events.push(EventListener.listen(this.getDOMNode(), 'click', this.handleClick));
if (this.state.useHistory) {
_events.push(EventListener.listen(window, 'popstate', this.onPopState));
} else {
if (window.location.hash.indexOf('#!') === -1) {
window.location.hash = '#!/';
}
_events.push(EventListener.listen(window, 'hashchange', this.onPopState));
}
},
componentWillUnmount: function() {
this._events.forEach(function(listener) {
listener.remove();
});
},
onPopState: function() {
var url = urllite(window.location.href),
hash = url.hash || '',
path = this.state.useHistory ? url.pathname : hash.slice(2);
if (path.length === 0) path = '/';
this.setState({ path: path + url.search });
},
renderCurrentRoute: function() {
var path = this.state.path,
url = urllite(path),
queryParams = parseSearch(url.search);
var parsedPath = url.pathname;
if (!parsedPath || parsedPath.length === 0) parsedPath = '/';
var matchedRoute = this.matchRoute(parsedPath);
if (matchedRoute) {
return matchedRoute.handler.apply(this, matchedRoute.params.concat(queryParams));
} else if (this.notFound) {
return this.notFound(parsedPath, queryParams);
} else {
throw new Error('No route matched path: ' + parsedPath);
}
},
handleClick: function(evt) {
var self = this,
url = getHref(evt);
if (url && self.matchRoute(url.pathname)) {
evt.preventDefault();
// See: http://facebook.github.io/react/docs/interactivity-and-dynamic-uis.html
// Give any component event listeners a chance to fire in the current event loop,
// since they happen at the end of the bubbling phase. (Allows an onClick prop to
// work correctly on the event target <a/> component.)
setTimeout(function() {
var pathWithSearch = url.pathname + (url.search || '');
if (pathWithSearch.length === 0) pathWithSearch = '/';
if (self.state.useHistory) {
window.history.pushState({}, '', pathWithSearch);
} else {
window.location.hash = '!' + pathWithSearch;
}
self.setState({ path: pathWithSearch});
}, 0);
}
},
matchRoute: function(path) {
if (!path) {
return false;
}
var matchedRoute = {};
this.state._routes.some(function(route) {
var matches = route.pattern.exec(path);
if (matches) {
matchedRoute.handler = route.handler;
matchedRoute.params = matches.slice(1, route.params.length + 1);
return true;
}
return false;
});
return matchedRoute.handler ? matchedRoute : false;
}
};
function getInitialPath(component) {
var path = component.props.path || component.context.path,
hash,
url;
if (!path && detect.canUseDOM) {
url = urllite(window.location.href);
if (component.props.history) {
path = url.pathname + url.search;
} else if (url.hash) {
hash = urllite(url.hash.slice(2));
path = hash.pathname + hash.search;
}
}
return path || '/';
}
function getHref(evt) {
if (evt.defaultPrevented) {
return;
}
if (evt.metaKey || evt.ctrlKey || evt.shiftKey) {
return;
}
if (evt.button !== 0) {
return;
}
var elt = getEventTarget(evt);
// Since a click could originate from a child element of the <a> tag,
// walk back up the tree to find it.
while (elt && elt.nodeName !== 'A') {
elt = elt.parentNode;
}
if (!elt) {
return;
}
if (elt.target && elt.target !== '_self') {
return;
}
if (!!elt.attributes.download) {
return;
}
var linkURL = urllite(elt.href);
var windowURL = urllite(window.location.href);
if (linkURL.protocol !== windowURL.protocol || linkURL.host !== windowURL.host) {
return;
}
return linkURL;
}
function processRoutes(root, routes, component) {
var patterns = [],
path, pattern, keys, handler, handlerFn;
for (path in routes) {
if (routes.hasOwnProperty(path)) {
keys = [];
pattern = pathToRegexp(root + path, keys);
handler = routes[path];
handlerFn = component[handler];
patterns.push({ pattern: pattern, params: keys, handler: handlerFn });
}
}
return patterns;
}
function parseSearch(str) {
var parsed = {};
if (str.indexOf('?') === 0) str = str.slice(1);
var pairs = str.split('&');
pairs.forEach(function(pair) {
var keyVal = pair.split('=');
parsed[decodeURIComponent(keyVal[0])] = decodeURIComponent(keyVal[1]);
});
return parsed;
}
/***/ },
/* 2 */
/***/ function(module, exports, __webpack_require__) {
var detect = __webpack_require__(4);
var event = __webpack_require__(5);
module.exports = function triggerUrl(url, silent) {
if (detect.hasHashbang()) {
window.location.hash = '#!' + url;
} else if (detect.hasPushState) {
window.history.pushState({}, '', url);
if (!silent) {
window.dispatchEvent(event.createEvent('popstate'));
}
} else {
console.error("Browser does not support pushState, and hash is missing a hashbang prefix!");
}
};
/***/ },
/* 3 */
/***/ function(module, exports, __webpack_require__) {
module.exports = React;
/***/ },
/* 4 */
/***/ function(module, exports, __webpack_require__) {
var canUseDOM = !!(
typeof window !== 'undefined' &&
window.document &&
window.document.createElement
);
module.exports = {
canUseDOM: canUseDOM,
hasPushState: canUseDOM && window.history && 'pushState' in window.history,
hasHashbang: function() {
return canUseDOM && window.location.hash.indexOf('#!') === 0;
},
hasEventConstructor: function() {
return typeof window.Event == "function";
}
};
/***/ },
/* 5 */
/***/ function(module, exports, __webpack_require__) {
var detect = __webpack_require__(4);
module.exports = {
createEvent: function(name) {
if (detect.hasEventConstructor()) {
return new window.Event(name);
} else {
var event = document.createEvent('Event');
event.initEvent(name, true, false);
return event;
}
}
};
/***/ },
/* 6 */
/***/ function(module, exports, __webpack_require__) {
var isArray = __webpack_require__(11);
/**
* Expose `pathToRegexp`.
*/
module.exports = pathToRegexp;
/**
* The main path matching regexp utility.
*
* @type {RegExp}
*/
var PATH_REGEXP = new RegExp([
// Match escaped characters that would otherwise appear in future matches.
// This allows the user to escape special characters that won't transform.
'(\\\\.)',
// Match Express-style parameters and un-named parameters with a prefix
// and optional suffixes. Matches appear as:
//
// "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?"]
// "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined]
'([\\/.])?(?:\\:(\\w+)(?:\\(((?:\\\\.|[^)])*)\\))?|\\(((?:\\\\.|[^)])*)\\))([+*?])?',
// Match regexp special characters that are always escaped.
'([.+*?=^!:${}()[\\]|\\/])'
].join('|'), 'g');
/**
* Escape the capturing group by escaping special characters and meaning.
*
* @param {String} group
* @return {String}
*/
function escapeGroup (group) {
return group.replace(/([=!:$\/()])/g, '\\$1');
}
/**
* Attach the keys as a property of the regexp.
*
* @param {RegExp} re
* @param {Array} keys
* @return {RegExp}
*/
function attachKeys (re, keys) {
re.keys = keys;
return re;
}
/**
* Get the flags for a regexp from the options.
*
* @param {Object} options
* @return {String}
*/
function flags (options) {
return options.sensitive ? '' : 'i';
}
/**
* Pull out keys from a regexp.
*
* @param {RegExp} path
* @param {Array} keys
* @return {RegExp}
*/
function regexpToRegexp (path, keys) {
// Use a negative lookahead to match only capturing groups.
var groups = path.source.match(/\((?!\?)/g);
if (groups) {
for (var i = 0; i < groups.length; i++) {
keys.push({
name: i,
delimiter: null,
optional: false,
repeat: false
});
}
}
return attachKeys(path, keys);
}
/**
* Transform an array into a regexp.
*
* @param {Array} path
* @param {Array} keys
* @param {Object} options
* @return {RegExp}
*/
function arrayToRegexp (path, keys, options) {
var parts = [];
for (var i = 0; i < path.length; i++) {
parts.push(pathToRegexp(path[i], keys, options).source);
}
var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options));
return attachKeys(regexp, keys);
}
/**
* Replace the specific tags with regexp strings.
*
* @param {String} path
* @param {Array} keys
* @return {String}
*/
function replacePath (path, keys) {
var index = 0;
function replace (_, escaped, prefix, key, capture, group, suffix, escape) {
if (escaped) {
return escaped;
}
if (escape) {
return '\\' + escape;
}
var repeat = suffix === '+' || suffix === '*';
var optional = suffix === '?' || suffix === '*';
keys.push({
name: key || index++,
delimiter: prefix || '/',
optional: optional,
repeat: repeat
});
prefix = prefix ? ('\\' + prefix) : '';
capture = escapeGroup(capture || group || '[^' + (prefix || '\\/') + ']+?');
if (repeat) {
capture = capture + '(?:' + prefix + capture + ')*';
}
if (optional) {
return '(?:' + prefix + '(' + capture + '))?';
}
// Basic parameter support.
return prefix + '(' + capture + ')';
}
return path.replace(PATH_REGEXP, replace);
}
/**
* Normalize the given path string, returning a regular expression.
*
* An empty array can be passed in for the keys, which will hold the
* placeholder key descriptions. For example, using `/user/:id`, `keys` will
* contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.
*
* @param {(String|RegExp|Array)} path
* @param {Array} [keys]
* @param {Object} [options]
* @return {RegExp}
*/
function pathToRegexp (path, keys, options) {
keys = keys || [];
if (!isArray(keys)) {
options = keys;
keys = [];
} else if (!options) {
options = {};
}
if (path instanceof RegExp) {
return regexpToRegexp(path, keys, options);
}
if (isArray(path)) {
return arrayToRegexp(path, keys, options);
}
var strict = options.strict;
var end = options.end !== false;
var route = replacePath(path, keys);
var endsWithSlash = path.charAt(path.length - 1) === '/';
// In non-strict mode we allow a slash at the end of match. If the path to
// match already ends with a slash, we remove it for consistency. The slash
// is valid at the end of a path match, not in the middle. This is important
// in non-ending mode, where "/test/" shouldn't match "/test//route".
if (!strict) {
route = (endsWithSlash ? route.slice(0, -2) : route) + '(?:\\/(?=$))?';
}
if (end) {
route += '$';
} else {
// In non-ending mode, we need the capturing groups to match as much as
// possible by using a positive lookahead to the end or next path segment.
route += strict && endsWithSlash ? '' : '(?=\\/|$)';
}
return attachKeys(new RegExp('^' + route, flags(options)), keys);
}
/***/ },
/* 7 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule EventListener
* @typechecks
*/
var emptyFunction = __webpack_require__(10);
/**
* Upstream version of event listener. Does not take into account specific
* nature of platform.
*/
var EventListener = {
/**
* Listen to DOM events during the bubble phase.
*
* @param {DOMEventTarget} target DOM element to register listener on.
* @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
* @param {function} callback Callback function.
* @return {object} Object with a `remove` method.
*/
listen: function(target, eventType, callback) {
if (target.addEventListener) {
target.addEventListener(eventType, callback, false);
return {
remove: function() {
target.removeEventListener(eventType, callback, false);
}
};
} else if (target.attachEvent) {
target.attachEvent('on' + eventType, callback);
return {
remove: function() {
target.detachEvent('on' + eventType, callback);
}
};
}
},
/**
* Listen to DOM events during the capture phase.
*
* @param {DOMEventTarget} target DOM element to register listener on.
* @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
* @param {function} callback Callback function.
* @return {object} Object with a `remove` method.
*/
capture: function(target, eventType, callback) {
if (!target.addEventListener) {
if ("production" !== process.env.NODE_ENV) {
console.error(
'Attempted to listen to events during the capture phase on a ' +
'browser that does not support the capture phase. Your application ' +
'will not receive some events.'
);
}
return {
remove: emptyFunction
};
} else {
target.addEventListener(eventType, callback, true);
return {
remove: function() {
target.removeEventListener(eventType, callback, true);
}
};
}
},
registerDefault: function() {}
};
module.exports = EventListener;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(12)))
/***/ },
/* 8 */
/***/ function(module, exports, __webpack_require__) {
/**
* Copyright 2013-2014, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule getEventTarget
* @typechecks static-only
*/
"use strict";
/**
* Gets the target node from a native browser event by accounting for
* inconsistencies in browser DOM APIs.
*
* @param {object} nativeEvent Native browser event.
* @return {DOMEventTarget} Target node.
*/
function getEventTarget(nativeEvent) {
var target = nativeEvent.target || nativeEvent.srcElement || window;
// Safari may fire events on text nodes (Node.TEXT_NODE is 3).
// @see http://www.quirksmode.org/js/events_properties.html
return target.nodeType === 3 ? target.parentNode : target;
}
module.exports = getEventTarget;
/***/ },
/* 9 */
/***/ function(module, exports, __webpack_require__) {
(function() {
var URL, URL_PATTERN, defaults, urllite,
__hasProp = {}.hasOwnProperty;
URL_PATTERN = /^(?:(?:([^:\/?\#]+:)\/+|(\/\/))(?:([a-z0-9-\._~%]+)(?::([a-z0-9-\._~%]+))?@)?(([a-z0-9-\._~%!$&'()*+,;=]+)(?::([0-9]+))?)?)?([^?\#]*?)(\?[^\#]*)?(\#.*)?$/;
urllite = function(raw, opts) {
return urllite.URL.parse(raw, opts);
};
urllite.URL = URL = (function() {
function URL(props) {
var k, v, _ref;
for (k in defaults) {
if (!__hasProp.call(defaults, k)) continue;
v = defaults[k];
this[k] = (_ref = props[k]) != null ? _ref : v;
}
this.host || (this.host = this.hostname && this.port ? "" + this.hostname + ":" + this.port : this.hostname ? this.hostname : '');
this.origin || (this.origin = this.protocol ? "" + this.protocol + "//" + this.host : '');
this.isAbsolutePathRelative = !this.host && this.pathname.charAt(0) === '/';
this.isPathRelative = !this.host && this.pathname.charAt(0) !== '/';
this.isRelative = this.isSchemeRelative || this.isAbsolutePathRelative || this.isPathRelative;
this.isAbsolute = !this.isRelative;
}
URL.parse = function(raw) {
var m, pathname, protocol;
m = raw.toString().match(URL_PATTERN);
pathname = m[8] || '';
protocol = m[1];
return new urllite.URL({
protocol: protocol,
username: m[3],
password: m[4],
hostname: m[6],
port: m[7],
pathname: protocol && pathname.charAt(0) !== '/' ? "/" + pathname : pathname,
search: m[9],
hash: m[10],
isSchemeRelative: m[2] != null
});
};
return URL;
})();
defaults = {
protocol: '',
username: '',
password: '',
host: '',
hostname: '',
port: '',
pathname: '',
search: '',
hash: '',
origin: '',
isSchemeRelative: false
};
module.exports = urllite;
}).call(this);
/***/ },
/* 10 */
/***/ function(module, exports, __webpack_require__) {
/**
* Copyright 2013-2014, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule emptyFunction
*/
function makeEmptyFunction(arg) {
return function() {
return arg;
};
}
/**
* This function accepts and discards inputs; it has no side effects. This is
* primarily useful idiomatically for overridable function endpoints which
* always need to be callable, since JS lacks a null-call idiom ala Cocoa.
*/
function emptyFunction() {}
emptyFunction.thatReturns = makeEmptyFunction;
emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
emptyFunction.thatReturnsNull = makeEmptyFunction(null);
emptyFunction.thatReturnsThis = function() { return this; };
emptyFunction.thatReturnsArgument = function(arg) { return arg; };
module.exports = emptyFunction;
/***/ },
/* 11 */
/***/ function(module, exports, __webpack_require__) {
module.exports = Array.isArray || function (arr) {
return Object.prototype.toString.call(arr) == '[object Array]';
};
/***/ },
/* 12 */
/***/ function(module, exports, __webpack_require__) {
// shim for using process in browser
var process = module.exports = {};
var queue = [];
var draining = false;
function drainQueue() {
if (draining) {
return;
}
draining = true;
var currentQueue;
var len = queue.length;
while(len) {
currentQueue = queue;
queue = [];
var i = -1;
while (++i < len) {
currentQueue[i]();
}
len = queue.length;
}
draining = false;
}
process.nextTick = function (fun) {
queue.push(fun);
if (!draining) {
setTimeout(drainQueue, 0);
}
};
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
process.version = ''; // empty string to avoid regexp issues
process.versions = {};
function noop() {}
process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.binding = function (name) {
throw new Error('process.binding is not supported');
};
// TODO(shtylman)
process.cwd = function () { return '/' };
process.chdir = function (dir) {
throw new Error('process.chdir is not supported');
};
process.umask = function() { return 0; };
/***/ }
/******/ ]);