Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/utils.js

Issue 29334223: Issue 3532 - Generate animation images at runtime (Closed)
Patch Set: Avoid warnings when closing tabs during animation Created Jan. 21, 2016, 10:28 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/notificationHelper.js ('k') | metadata.chrome » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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); });
+ });
}
};
« no previous file with comments | « lib/notificationHelper.js ('k') | metadata.chrome » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld