Skip to content

module.builtin() is not documented #328

@mootari

Description

@mootari

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to docs

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions