By Brandon Satrom
Read or Download Building Polyfills: Web Platform APIs for the Present and Future PDF
Approximately This Book
Understand how net 2. zero is made by means of robust browser-based applications
Step-by-step educational that would express you ways speedy, advanced net functions will be built
Who This ebook Is For
This booklet relies on Meteor 1. zero.
- Perl in a Nutshell, Edition: Second Edition
- Learning jQuery, Third Edition
Extra info for Building Polyfills: Web Platform APIs for the Present and Future
First, I’ll create the core source file for my polyfill in the src/ folder for my project. js, which follows a naming convention similar to other Kendo UI source files. Then, in my new source file, I’ll include the code in Example 3-3. Example 3-3. Form). kendoForm. plugin(Form); } (jQuery, kendo)); As illustrated here, my polyfill starts with an Immediately-Invoked Function Expres‐ sion (IIFE) that specifies my dependencies (jQuery and Kendo UI in this case). Next, I create some local lookup variables to cache key parts of the Kendo UI namespace.
Now, when I view the sample form in Safari, Firefox, or Internet Explorer (all browsers that do not support the color type at the time of writing), I’ll see a Kendo UI ColorPicker in place of the default text input, as seen in Figure 3-4. Figure 3-4. info To Feature Detect or Not to Feature Detect Of course, there’s a catch. As it happens, if you view the sample page in a browser that does support the color type (like Chrome or Opera), you’ll notice that a ColorPicker was created in these browsers as well.
For the examples in this book, I’ve chosen Git as my source control solution and GitHub for code sharing and distribution. Setting Up the Initial Project Structure Once I’ve chosen a source control solution, I’m ready to set up my project. I’ll start by creating a new folder for my polyfill, called kendo-ui-forms in my usual development folder on my machine. Then, I’ll open a terminal window in that directory and initialize a new GitHub repo by running the git init command. git. If you’re not familiar with setting up a new remote repository, head over to GitHub, create a new repository for your project, and follow the on-screen instructions.