Expose mdc-ripple's util.js for ES5
See original GitHub issueI’m implementing custom MDCRippleFoundation adapter.
As you mentioned in document, supportsCssVariables
function in util.js
would be useful to implement browserSupportsCssVars() => boolean
.
But, @material/ripple/dist/mdc.ripple
does not exposes the utils
module. So I cannot use the module without transpiler configured for MDC.
/*
* In `some_library/src/foo.js`
* Will be transpiled to ES5 code in `some_library/lib/foo.js`
*/
import {supportsCssVariables} from '@material/ripple/util';
...
If i use transpiler to use that module, users of some_library also have to use same transpiler. But It does not seem to be good constraints.
/* In application that does not use any transpiler */
// Raises syntax error when importing `@material/ripple/util`
var RippleWrapper = require('some_library/lib/foo.js');
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:5 (4 by maintainers)
Top Results From Across the Web
es5-util - npm
ES5 Utilities. A set of lightweight ES5 Utility functions can be either used in the browser or in Node.js. Heavily inspired by Locutus ......
Read more >ES5 to ESNext — here's every feature added to JavaScript ...
Creating a promise. The Promise API exposes a Promise constructor, which you initialize using new Promise() : let done = ...
Read more >Understand the different javascript modules formats
utils.js // we create a function function add(r){ return r + r; } // export (expose) add to other modules exports.add = add;...
Read more >JavaScript ES5 - W3Schools
ECMAScript 2009, also known as ES5, was the first major revision to JavaScript. This chapter describes the most important features of ES5.
Read more >Build a JavaScript Util Library for NPM with ES6 Modules and ...
Goals. Have one code source that transpiles into both ES6 and CommonJS (ES5); Tree-shakable for ES6; Implement unit testing with Jest; Auto-generate the ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Hardtack fair point. I can see the value in exposing the ripple’s
util
module viaindex.js
. However, as a general rule we’ll probably only exposeutil
-like modules on a case-by-case basis.We don’t want to add too much to a public API right off the bat, only to change/remove something thus causing a breaking change.
I also had that problem.
Anyhow for now you can circumvent it by doing the following:
This will give you a default foundation that already uses
supportsCssVariables
so you don’t have to implement it yourself.