Home > Web Front-end > JS Tutorial > Shims in Web Development

Shims in Web Development

WBOY
Release: 2024-07-19 15:57:00
Original
674 people have browsed it

Introduction

In programming, a shim acts as a bridge between your code and an underlying system, allowing you to use features that might not be natively supported.

Web Shims

There was a time when certain JavaScript methods such as Array.prototype.includes were not readily supported in browsers even though production apps made use of it. To work around this issue, developers began to create scripts that patched in the implementations. The polyfill (shim) acted as a layer between the code and the browser's native functionality. The polyfill provided a dynamic way to detect and address missing features, creating a consistent experience across browsers.

Polyfill Shim

Runtime Shims

As a rubyist, you will need to manage multiple ruby runtime versions on your development machine. You can install each binary manually or you can use a runtime version manager asdf. Asdf allows you to install and switch between different ruby interpreter versions easily. asdf installs the executables using plugins while also creating shims inside ~/.asdf/shims. Running the ruby executable results in running the shim instead. The version of the executable asdf uses is defined in ~/.tool-versions.

Summary

Shims are a handy technique in everyday programming that smooth out compatibility issues between your code and the environment it runs in.

The above is the detailed content of Shims in Web Development. For more information, please follow other related articles on the PHP Chinese website!

source:dev.to
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template