Skip to content
This repository has been archived by the owner on Oct 2, 2021. It is now read-only.

Commit

Permalink
Reuse client-side native Promise if available.
Browse files Browse the repository at this point in the history
Also note that the webpack bundle is now called promise.bundle.js.
  • Loading branch information
Ben Newman committed Jul 21, 2015
1 parent 6668d85 commit 2109797
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ build/Release
node_modules

# Auto-generated by npm install / webpack.
promise_client.js
promise.bundle.js
4 changes: 4 additions & 0 deletions promise_client.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
var global = Function("return this")();
if (typeof global.Promise !== "function") {
global.Promise = require("promise");
}
6 changes: 2 additions & 4 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
module.exports = {
context: __dirname,
entry: "promise",
entry: "./promise_client.js",
output: {
library: "Promise",
libraryTarget: "this",
path: __dirname,
filename: "promise_client.js"
filename: "promise.bundle.js"
}
};

0 comments on commit 2109797

Please sign in to comment.