Code Monkey home page Code Monkey logo

Comments (10)

longlho avatar longlho commented on August 18, 2024

hmm you can use JSONP if you don't wanna deal w/ CORS stuff. Can you clarify your proposed method a bit?

from timezone-js.

minixxie avatar minixxie commented on August 18, 2024

something like:

<script src="all-cities-tz-data.js" />
<script src="timezone-js/date.js" />
<script>
$(document).ready(function(){
    timezoneJS.timezone.parseJsonData( tzData );
});
</script>

where all-cities-tz-data.js is an assignment of the node-parse.js generated data to an variable:

var tzData = {
zones: { .... 
};

As in symfony2, I can "concatenate" the above 2 js files into one, with its "Assetic" bundle, these 2 js files will finally require only ONE requests. And this request can be fetched from another "origin".

I have no experience on JSONP so my suggestion here may not be good enough, this is just for a reference.

Simon

from timezone-js.

longlho avatar longlho commented on August 18, 2024

hmm my suggestion would be what you've already had right now, which is pre-processed static data (minified and gzipped) and send everything down as 1 min.js to avoid extra asset loading requests.

During the pre-process stage you can embed JSON no problem.

from timezone-js.

minixxie avatar minixxie commented on August 18, 2024

I see. Thanks for your info. Right now, I couldn't find any "parseJsonData()" like function to call, so I'm using it with an extra "sync" request now. But it has some other errors reported, let me write them in a separate issue.

from timezone-js.

longlho avatar longlho commented on August 18, 2024

hmm have you tried loadZoneDataFromObject?

from timezone-js.

minixxie avatar minixxie commented on August 18, 2024

Oh I didn't. Thanks for your reminder. Finally I got it work with:

timezoneJS.timezone.loadingScheme = timezoneJS.timezone.loadingSchemes.MANUAL_LOAD;
timezoneJS.timezone.loadZoneJSONData('/tz/all-tz.json', true);

but if I change the above "true" to "false", I got error:
hms is null

from timezone-js.

longlho avatar longlho commented on August 18, 2024

hmm I'll try to take a look at it. Can u throw in a bug report for it? Did loadZoneDataFromObject work for your use case?

from timezone-js.

minixxie avatar minixxie commented on August 18, 2024

I think I'm not going to use loadZoneDataFromObject for now. loadZoneJSONData() now works well for me (with sync=true). Thanks.

from timezone-js.

longlho avatar longlho commented on August 18, 2024

Cool :) Tks

from timezone-js.

minixxie avatar minixxie commented on August 18, 2024

Thank you :D
btw, reported the above "hms is null" in #68

from timezone-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.