Git Product home page Git Product logo

Comments (4)

WickyNilliams avatar WickyNilliams commented on August 15, 2024

Hey pat,

Good catch, you're completely right! Serves my right for neglecting to
write unit tests for this part of the code base! By the way, thanks for the
fiddle and little investigation that went with it, if only everybody was as
courteous in reporting issues :-)

However the fix isn't as simple as the one you provided. The reason being
that sometimes match must be called asynchronously, specifically in the
context of conditional loading - you want match to be called after all
assets have been loaded otherwise you're in for a race condition.

Thankfully though, the actual fix is just as simple. Will get something
pushed out shortly.
On 11 Mar 2013 01:02, "patocallaghan" [email protected] wrote:

Hey Nicky,

I've been trying out this experimental branch but I think I've found an
issue. Matches don't fire by default when the page loads when the page is
within a mediaquery. I've created a demo herehttp://codepen.io/patocallaghan/pen/dwqDC.
You should get a log of match in the console but it doesn't fire.

I've narrowed it down to this line in the code

Line 103
!this.initialised ? this.setup() : this.options.match();

if initialised is false this.options.match() never runs. I swapped it for
the code from the current stable version and the match correctly fired on
page load.

if(!this.initialised){
this.setup(e);}this.options.match(e);

Am I missing something or is this a bug?

Thanks,
Pat


Reply to this email directly or view it on GitHubhttps://github.com//issues/40
.

from enquire.js.

WickyNilliams avatar WickyNilliams commented on August 15, 2024

Give that a try, should be good. Also added unit tests to make sure I don't regress in future :)

from enquire.js.

patocallaghan avatar patocallaghan commented on August 15, 2024

No worries on the pen and thanks for the quick turnaround.....It worked perfectly :)

Besides the issue above I've found the new version quite good..any ideas on an ETA when you are going stable with it?

I'm using it in a project at the moment so I guess if any issues arise I'll let you know. Saying that though, the extent of how I am using it is quite limited, essentially all my calls use the following pattern. I don't use any of the new whizz-bang stuff:

enquire.register(config.query, {
    match: config.match,
    unmatch: config.unmatch,
    shouldDegrade: config.shouldDegrade
});

from enquire.js.

WickyNilliams avatar WickyNilliams commented on August 15, 2024

Good to hear all is well!

My plan is to finish off the docs then push it out. There's unlikely to be any feature changes at this point so feel free to continue using it. The only changes will be bug fixes, which will hopefully be discovered by fine chaps like yourself using the new version early :)

I'll close this issue now.

PS. You can simplify you code to this:

enquire.register(config.query, config);

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