On Sep 28, 2014 1:07 AM, Domenic Denicola dome...@domenicdenicola.com
wrote:
From: es-discuss [mailto:es-discuss-boun...@mozilla.org] On Behalf Of
John Lenz
I would like to see some way to preload everything, and be able to
retrieve them synchronously, something like:
Sounds like a good
I'm confused. We went from bundled, synchronous modules to asynchronous
modules... Why exactly?
And what about the offline case where modules are loaded from disk or are
even complied into an archive file (for fast seek times on rotating disks)?
Are those use cases not important to TC39?
Does
On 28 September 2014 07:01, John Lenz concavel...@gmail.com wrote:
I would like to see some way to preload everything, and be able to
retrieve them synchronously, something like:
System.loader.addNoAsync('...'); // throw if all imports aren't
available already
So that the script could
Also you CAN potentially do something like this eventually:
```
(async function() {
var myMod = await System.import(my-mod);
})()
```
- Matthew Robb
On Sun, Sep 28, 2014 at 11:45 AM, Guy Bedford guybedf...@gmail.com wrote:
On 28 September 2014 07:01, John Lenz concavel...@gmail.com wrote:
What is wrong with Loader.get()?
---
Reflect.Loader.prototype.get ( name )If this Loader's module registry
contains a Module with the given normalized name, return it. Otherwise,
return undefined. If the module is in the registry but has never been
evaluated, first synchronously evaluate the
What is wrong with asynchronous loads other than the fact that they
can't be used in synchronous algorithms, you mean? (i.e. the vast
majority of existing software)
That seems to be the motive: Not synchronous network or disk i/o, just
synchronous import. I can see how there's perhaps a moral
I would like to see some way to preload everything, and be able to retrieve
them synchronously, something like:
System.loader.addNoAsync('...'); // throw if all imports aren't
available already
So that the script could be used during initial render. I understand that
this would mean that the
From: es-discuss [mailto:es-discuss-boun...@mozilla.org] On Behalf Of John Lenz
I would like to see some way to preload everything, and be able to retrieve
them synchronously, something like:
Sounds like a good custom loader extension that you could write.
Can I import module dynamically, but synchronously? Example for common js
```js
var moduleName = 'foo';
var foo = require(moduleName);
```
In es6 draft I found that ModuleSpecifier must be a StringLiteral
http://people.mozilla.org/~jorendorff/es6-draft.html#sec-imports
no.
On Fri, Sep 26, 2014 at 8:12 AM, Konstantin Ikonnikov ikokos...@gmail.com
wrote:
Can I import module dynamically, but synchronously? Example for common js
```js
var moduleName = 'foo';
var foo = require(moduleName);
```
In es6 draft I found that ModuleSpecifier must be a
And the reason you cannot import a module synchronously is that it would
freeze the entire browser until the http request completes, which could be
several seconds on a slow internet connection.
If you want to import something dynamically you can do it using the API (to
be finalized, I believe):
Konstantin Ikonnikov wrote:
Can I import module dynamically, but synchronously? Example for common js
```js
var moduleName = 'foo';
var foo = require(moduleName);
```
You can't do that in the browser, as followups point out. Do you use
browserify or similar to make this seem to work? If so,
I don't want load module using http request. In my case module already
defined and I want import it later when I get its name:
```js
var moduleName = getModuleName();
import { foo } from moduleName;
// use foo
```
2014-09-26 20:00 GMT+04:00 Marius Gundersen gunder...@gmail.com:
And the
```js
var moduleName = 'foo';
var foo = require(moduleName);
```
would not work in browserify either
On Fri, Sep 26, 2014 at 12:40 PM, Konstantin Ikonnikov ikokos...@gmail.com
wrote:
I don't want load module using http request. In my case module already
defined and I want import it later when
```js
var moduleName = 'foo';
var foo = require(moduleName);
```
would not work in browserify either
It does work in browserify, but you need to be sure to include it in a list
of requires if it is not imported by the current list of files statically
(ala `browserify -e main.js -r foo`).
true and by that same token it is possible to use the loader api to get
similar results out of ES6 modules (
https://github.com/calvinmetcalf/es6-translate)
On Fri, Sep 26, 2014 at 3:46 PM, Bradley Meck bradley.m...@gmail.com
wrote:
```js
var moduleName = 'foo';
var foo =
Theoretically you can use System.normalize() and System.get() to lookup a
module by name synchronously. The normalize feature requires a referrer or
address.
Since browsers are determined to eliminate synchronous scripts, you may as
well deal with the asynchronous System.import() and obnoxious
17 matches
Mail list logo