Show More
@@ -365,6 +365,18 b' IPython.utils = (function (IPython) {' | |||
|
365 | 365 | test.remove(); |
|
366 | 366 | return Math.floor(points*pixel_per_point); |
|
367 | 367 | }; |
|
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 | }; | |
|
368 | 380 | |
|
369 | 381 | |
|
370 | 382 | var url_path_join = function () { |
@@ -416,6 +428,7 b' IPython.utils = (function (IPython) {' | |||
|
416 | 428 | points_to_pixels : points_to_pixels, |
|
417 | 429 | url_path_join : url_path_join, |
|
418 | 430 | splitext : splitext, |
|
431 | always_new : always_new, | |
|
419 | 432 | browser : browser |
|
420 | 433 | }; |
|
421 | 434 |
General Comments 0
You need to be logged in to leave comments.
Login now