You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now that we are using async, some work is done asynchronously.
Previously we were using synchronous code with callbacks and the Asciidoctor's processor was registered as a global variable. Custom scripts were appended synchronously to the web page and could access this global variable. Now that custom scripts are appended asynchronously, we can't access this global variable anymore.
However, while it was working, using a global variable was not a perfect solution.
EDIT: This is actually wrong, see below.
The Asciidoctor processor is defined in a content script and we need to find a solution to be able to register user defined extensions.
Content scripts execute in a special environment called an isolated world. They have access to the DOM of the page they are injected into, but not to any JavaScript variables or functions created by the page. It looks to each content script as if there is no other JavaScript executing on the page it is running on. The same is true in reverse: JavaScript running on the page cannot call any functions or access any variables defined by content scripts.
Content scripts can access and modify the page's DOM, just like normal page scripts can. They can also see any changes that were made to the DOM by page scripts.
However, content scripts get a "clean view of the DOM". This means:
content scripts cannot see JavaScript variables defined by page scripts
if a page script redefines a built-in DOM property, the content script will see the original version of the property, not the redefined version.
ggrossetie
changed the title
Scope and extension registration with asynchronous code
Allow custom scripts to have access to the Asciidoctor processor
Mar 17, 2018
ggrossetie
changed the title
Allow custom scripts to have access to the Asciidoctor processor
Custom scripts should have access to the Asciidoctor processor
Mar 17, 2018
Now that we are usingasync
, some work is done asynchronously.Previously we were using synchronous code with callbacks and the Asciidoctor's processor was registered as a global variable. Custom scripts were appended synchronously to the web page and could access this global variable. Now that custom scripts are appended asynchronously, we can't access this global variable anymore.
However, while it was working, using a global variable was not a perfect solution.
EDIT: This is actually wrong, see below.
The Asciidoctor processor is defined in a content script and we need to find a solution to be able to register user defined extensions.
References:
The text was updated successfully, but these errors were encountered: