Giter Site home page Giter Site logo

Comments (9)

ifandelse avatar ifandelse commented on July 18, 2024

@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.

tleite avatar tleite commented on July 18, 2024

I'm using the latest Chrome on Windows 7, Underscore 1.1.7
This was in local dev on IIS .Net

from postal.js.

dcneiner avatar dcneiner commented on July 18, 2024

@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.

ifandelse avatar ifandelse commented on July 18, 2024

@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.

tleite avatar tleite commented on July 18, 2024

I'm using requireJs to load.
Postal version is 0.8.2

Here is the beginning chunk of the file:

Screen Shot 2013-01-24 at 6 54 08 PM

from postal.js.

dcneiner avatar dcneiner commented on July 18, 2024

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.

ifandelse avatar ifandelse commented on July 18, 2024

@tleite - I thought I'd throw these here as well (@dcneiner put these together):

from postal.js.

tleite avatar tleite commented on July 18, 2024

Works like a charm! Thank you all for the support!

from postal.js.

ifandelse avatar ifandelse commented on July 18, 2024

@tleite - no problem! Glad you got it taken care of.

from postal.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.