Show More
@@ -366,6 +366,18 IPython.utils = (function (IPython) { | |||||
366 | return Math.floor(points*pixel_per_point); |
|
366 | return Math.floor(points*pixel_per_point); | |
367 | }; |
|
367 | }; | |
368 |
|
368 | |||
|
369 | var always_new = function (constructor) { | |||
|
370 | // wrapper around contructor to avoid requiring `var a = new constructor()` | |||
|
371 | // useful for passing constructors as callbacks, | |||
|
372 | // not for programmer laziness. | |||
|
373 | // from http://programmers.stackexchange.com/questions/118798 | |||
|
374 | return function () { | |||
|
375 | var obj = Object.create(constructor.prototype); | |||
|
376 | constructor.apply(obj, arguments); | |||
|
377 | return obj; | |||
|
378 | }; | |||
|
379 | }; | |||
|
380 | ||||
369 |
|
381 | |||
370 | var url_path_join = function () { |
|
382 | var url_path_join = function () { | |
371 | // join a sequence of url components with '/' |
|
383 | // join a sequence of url components with '/' | |
@@ -416,6 +428,7 IPython.utils = (function (IPython) { | |||||
416 | points_to_pixels : points_to_pixels, |
|
428 | points_to_pixels : points_to_pixels, | |
417 | url_path_join : url_path_join, |
|
429 | url_path_join : url_path_join, | |
418 | splitext : splitext, |
|
430 | splitext : splitext, | |
|
431 | always_new : always_new, | |||
419 | browser : browser |
|
432 | browser : browser | |
420 | }; |
|
433 | }; | |
421 |
|
434 |
General Comments 0
You need to be logged in to leave comments.
Login now