| Index: lib/utils.js |
| diff --git a/lib/utils.js b/lib/utils.js |
| index 655ad95c377f5d5fa1fb3c1f8584ea710c376226..b04e7729bc7c4871697a93bae0cf101e084c3c47 100644 |
| --- a/lib/utils.js |
| +++ b/lib/utils.js |
| @@ -119,5 +119,19 @@ var Utils = exports.Utils = { |
| yield: function() |
| { |
| + }, |
| + |
| + loadImage: function(path, size) |
| + { |
| + if (!path) |
| + return Promise.resolve(null); |
| + if (size) |
| + path = path.replace("$size", size.toString()); |
| + |
| + return new Promise(function(resolve, reject) { |
| + let image = new Image(); |
| + image.src = path; |
| + image.addEventListener("load", function() { resolve(image); }); |
| + }); |
| } |
| }; |