Skip to content

How to inject multi line JS code in ___pragma___()? #899

@warrenchopin

Description

@warrenchopin

Hi again,

I am trying to use __pragma__() to inject multi line JS code. The introductory webpages in transcrypt.org shows that it can be imported from org.transcrypt.stubs:

from org.transcrypt.stubs.browser import __pragma__
def run (autoTester):
   ...
       __pragma__ ('js', '{}', 'self ["__dict__"] = {}')

link: https://www.transcrypt.org/docs/html/supported_constructs.html?highlight=__pragma__%20js#attribute-proxies-by-name-getattr-setattr

But, when I tried this way, 'org' not found error was raised. How can I import __pragma__?

I was using __pragma__ by copying the org.transcrypt.stubs directory to my local, and it worked. But I encountered an error when I upgraded the Transcrypt newest version 3.9.4. I think that copying the directory is not the right way.

Using #__pragma__ allows only single line code. If there is a way to inject multi line JS code, please tell me.

Thanks advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions