Comments (4)
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.
Give that a try, should be good. Also added unit tests to make sure I don't regress in future :)
from enquire.js.
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.
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)
- Unit tests for registered media query callbacks. HOT 1
- Playing nice with Foundation 6 Framework HOT 2
- Enquire.js and Fullpage.js not playing nice HOT 2
- Only matched is fired, why? HOT 1
- Menu HOT 2
- Newest version on npm HOT 3
- matchMedia polyfill error HOT 2
- Can you please publish it with the distribution version on npm
- typescript definitions HOT 1
- Compilation warning (version 2.1.4) HOT 11
- matchMedia polyfill stopped working with latest release HOT 10
- Looking for maintainers HOT 4
- bower.json version mismatch HOT 2
- trigger when page loaded first time
- Error: matchMedia not present, legacy browsers require a polyfill HOT 1
- enquire is undefined HOT 6
- Enquire.js (on Shopify Debut Theme) Breaks Bootstrap Modal function HOT 1
- Not working in latest version of Edge on Windows 10
- How to enable enquire.js for a drupal project
- Inspired by Enquire.js
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 enquire.js.