Skip to content

Instantly share code, notes, and snippets.

View sndrs's full-sized avatar
🐛

Alex Sanders sndrs

🐛
View GitHub Profile
export type TaskPriority = "user-blocking" | "user-visible" | "background";
export type SchedulerPostTaskOptions = {
// This priority is immutable and overrides the
// TaskController's priority.
priority?: TaskPriority;
delay?: number;
signal?: TaskSignal;
};
@sindresorhus
sindresorhus / esm-package.md
Last active April 26, 2024 03:53
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@ebidel
ebidel / feature_detect_es_modules.js
Last active September 4, 2023 13:56
Feature detect ES modules: both static import and dynamic import()
<!--
Complete feature detection for ES modules. Covers:
1. Static import: import * from './foo.js';
2. Dynamic import(): import('./foo.js').then(module => {...});
Demo: http://jsbin.com/tilisaledu/1/edit?html,output
Thanks to @_gsathya, @kevincennis, @rauschma, @malyw for the help.
-->
@NateWr
NateWr / imager-for-wp.php
Created March 12, 2014 01:07
Integrate Imager.js with WordPress
<?php
/**
* Integrate Imager.js with WordPress
*
* Imager.js is BBC's solution for serving responsive and retina images, without
* the double payload issues that affect other solutions. For more information:
*
* https://github.com/BBC-News/Imager.js/
*
* This collection of functions modifies the output of WordPress's