Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

module.builtin() is not documented #328

Open
mootari opened this issue Feb 23, 2022 · 1 comment
Open

module.builtin() is not documented #328

mootari opened this issue Feb 23, 2022 · 1 comment

Comments

@mootari
Copy link
Member

mootari commented Feb 23, 2022

Compiled Observable notebooks with file attachments call main.builtin() to register a FileAttachment builtin that is local to the module:

const main = runtime.module();
const fileAttachments = new Map([["chinook.db","https://static.observableusercontent.com/files/b3711cfd9bdf50cbe4e74751164d28e907ce366cd4bf56a39a980a48fdc5f998c42a019716a8033e2b54defdd97e4a55ebe4f6464b4f0678ea0311532605a115"]]);
main.builtin("FileAttachment", runtime.fileAttachments(name => fileAttachments.get(name)));

This is currently the only way to define local builtins, as the second argument of the Module constructor is not exposed via runtime.module(). Unfortunately the method is not documented.

@mootari
Copy link
Member Author

mootari commented Feb 23, 2022

(As an aside, runtime.fileAttachments isn't documented either.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant