Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue w/ head.load #522

Merged
merged 4 commits into from
Jun 22, 2017
Merged

Issue w/ head.load #522

merged 4 commits into from
Jun 22, 2017

Conversation

mattiaerre
Copy link
Member

@mattiaerre mattiaerre commented Jun 20, 2017

Description

the following gif shows that when replacing head.load w/ l it is possible to wait until the asset has been loaded before firing a callback function; this PR includes also the 2 html files used in order to record the video.

the first part shows the behavior w/ head.load simulating a Regular 2G network w/ Chrome dev tool; the second part shows the behavior w/ l simulating the same network speed.

The test is fetching a .css and a .js file.

ljs-2

the source code of the l library

Changes

  • add the l library (and update .eslintignore)

  • update build.js so that it is including l inside oc-client.min.js when grunt build

  • use l instead of head.load inside karma-common (grunt karma:local still works)

@mattiaerre mattiaerre self-assigned this Jun 20, 2017
@mattiaerre
Copy link
Member Author

this PR tries to fix #281

// cc @matteofigus

Copy link
Member Author

@mattiaerre mattiaerre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

over to you @matteofigus

done();
});
});
module.exports = function(grunt) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this has been reformatted because of prettier

}
}
//export ljs (as `head`)
window.head = loader;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the only workaround applied 😅

Copy link
Member

@matteofigus matteofigus Jun 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well this is temporary right? If we would want to go for it, we can change the library to make it use ljs instead and it should work I guess

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you want me to use ljs instead of head as the name of the loader? sure I'll try to do that. I will also test CSS loading.

Copy link
Member

@matteofigus matteofigus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C'est formidable!

I think that this library does the job well, and despite not being super active, it makes all the tests pass, so I would say let's go for it.

I see that you did a good job on setting up a manual test too. The only think we may want to test (which I think is not covered by the karma tests) is css loading with oc.require. This library should support it according to the docs, but I just to ensure that we can keep all retro-compatible ;)

@mattiaerre
Copy link
Member Author

@matteofigus I updated this PR that now uses a global ljs name instead of head; I've also fixed the tests and tried to load a .css file (and re-recorded a short video w/ that). the only caveat w/ css is that the callback is raised synchronously before the load completion. But this happens for both head.load and ljs. It is how CSS loading works (I guess). If you are happy I can get rid of the examples and the head.load lib from this PR so that you can merge and build; unless you want me to include the build here.

Copy link
Member Author

@mattiaerre mattiaerre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

over to you @matteofigus

}
}
//export ljs
window.ljs = loader;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as per the lib now the global name is ljs

@matteofigus
Copy link
Member

Sounds good. Let's remember to update this file too https://github.com/opentable/oc/blob/master/src/components/oc-client/LICENSES

Copy link
Member Author

@mattiaerre mattiaerre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated LICENSES and removed head.load

@@ -27,7 +27,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
OC wouldn't exist without some fantastic Open-Source libraries:

* jQuery
* head.js
* l.js
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@matteofigus let me know if this is good for you

@mattiaerre mattiaerre changed the title [DO NOT MERGE] - issue w/ head.load Issue w/ head.load Jun 20, 2017
@mattiaerre mattiaerre removed the wip label Jun 20, 2017
@mattiaerre
Copy link
Member Author

mattiaerre commented Jun 20, 2017

all 💚 over to you @matteofigus

// cc @NapoleanReigns

@matteofigus matteofigus merged commit b1cc4b3 into master Jun 22, 2017
@matteofigus matteofigus deleted the ljs branch June 22, 2017 16:26
@matteofigus
Copy link
Member

matteofigus commented Jun 22, 2017

Fantastic. I decided to go live with a new minor (0.38.0) because despite this should be a non breaking change, there was a non explicit contract on exposing head so it is better to toggle a minor for clarity. For most of the users, this should be an easy upgrade.

@mattiaerre
Copy link
Member Author

I wanted to wait a couple of weeks (just to make sure that there was no production issue) but now I'd like to take some time and thank @malko for his l.js library that helped us smoothly to transition from head.js. Very good job and thanks again; OSS rulez 😎

// cc @matteofigus @nickbalestra

@malko
Copy link

malko commented Jul 5, 2017

@mattiaerre thank for your mention and use of ljs. Glad it can help you. As said earlier in the comment the repository is not really active but i want to assure you that this is not a dead project, I still accept PR and take a look to it on a regular basis. I just don't have more need for it at this time but as said PR are welcome as long as it don't forget the purpose of ljs, stay a micro library.
Hope you'll be happy with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants