Skip to content

[FireMonkey] import statement handling #333

Answered by erosman
LucidicShadow asked this question in Q&A
Discussion options

You must be logged in to vote

I have discussed import in userscript context with Mozilla engineers.

Normally, the JavaScript engine would get the module and then make it available to the JS code that imported it.

That is not possible within userscript context since there is no process to get the the module.

Module Import example

Module app.js

export {App};

class App {

  static run() {
    console.log('App.run called');
  }
}

Importer

import {App} from './app.js';

App.run();

Mimic Module Import in userscript example

Note: import/export cause error

SyntaxError: export declarations may only appear at top level of a module
SyntaxError: import declarations may only appear at top level of a module

Module

// ==UserScript==

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@LucidicShadow
Comment options

Answer selected by LucidicShadow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants