Comments (9)
@tleite - thanks for the heads up on this. I'll need to investigate further, but after glancing at the UMD wrapper for postal, I'm willing to bet that document is getting passed as root instead of window here (as the this
arg): https://github.com/postaljs/postal.js/blob/master/lib/postal.js#L23
Another possible workaround might be to change that line to:
}( window || this, function ( _, global, undefined ) {
Just a guess on my part (at 3 AM). :-) I will look at reproducing the issue tomorrow once I've slept. Speaking of reproducing the issue - if you get a chance let me know what browser, underscore version you're using, as well as if this was just in local dev, or if you were using a site like jsfiddle or jsbin when you get the error. Thanks!
from postal.js.
I'm using the latest Chrome on Windows 7, Underscore 1.1.7
This was in local dev on IIS .Net
from postal.js.
@tleite - How are you including postal on the page? Are you using any sort of script loader, or is it included with normal <script src=""></script>
tags?
from postal.js.
@tleite - what version of postal are you using? Also - what @dcneiner asked would be important to know - an AMD project, or standard browser libs?
from postal.js.
I'm using requireJs to load.
Postal version is 0.8.2
Here is the beginning chunk of the file:
from postal.js.
Hi @tleite!
I suspected this might be the case. As long as you are using RequireJS 2.x this is an easy fix. Basically, underscore is not AMD compatible by default, so you need to use the "shim" feature (and include postal via AMD):
requirejs.config({
paths: {
"underscore": "lib/underscore",
"postal": "lib/postal"
},
shim: {
"underscore": {
exports: "_"
}
}
});
requirejs( [ "postal" ], function ( postal ) {
// do stuff with postal
});
from postal.js.
@tleite - I thought I'd throw these here as well (@dcneiner put these together):
- fiddle showing reproducing the issue when underscore isn't shimmed: http://jsfiddle.net/UpMwt/
- fiddle showing it working when the shim is in place: http://jsfiddle.net/UpMwt/2/
from postal.js.
Works like a charm! Thank you all for the support!
from postal.js.
@tleite - no problem! Glad you got it taken care of.
from postal.js.
Related Issues (20)
- How to publish data between Node.js modules? HOT 2
- Bower Release v2.0.5
- Competing consumers HOT 1
- Help improve the quality of the DefinitelyTyped (TypeScript) definitions
- postal.preserve: Still taking a ConduitJS dependency HOT 2
- Default Subscriber
- Stack overflow in IE 11 when publish called on channel with many pending unsubscribes
- Shouldn't postal.channel() implement the Singleton pattern? HOT 2
- Subscriber callback method can brake calling other subscribers HOT 1
- Devtools extension for Chrome
- Messages published inside a subscriber won't be passed to uncached subscribers
- why cache only for result === true
- postal.lodash.js Error: Module name "lodash/after" has not been loaded
- Is this project still active? HOT 6
- Wait for messages to be delivered and processed in unit tests
- timeStamp in envelope should honor timezone
- Timestamp missing on wireTap envelopes
- Thank you
- Regarding publish and subscribe, Important question
- How does postal.js support replay?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from postal.js.