Uncodie
Technical DocumentationNo CodeTutorialsChangelogDisccord
Developers
Developers
  • 📖Documentation
    • Basic Concepts
      • Node JS
      • React
      • Postgres SQL
      • GraphQL
      • Git
      • API
  • 🔌API
    • Getting Started
      • Credentials
    • Users
      • Register User
    • Component Interface
      • Props
  • 🤖IDE
    • Getting started
    • Component View
      • CSS
      • Controller
      • Component
    • Compiler
    • Importing Code
      • Scripts
        • Manifest
      • Connectors
        • Manifest
      • Components
        • Manifest
    • Exporting Code
      • Design Systems
        • Custom React libraries
      • Guidelines
  • ⚙️Figma Plugin
    • Variables
      • Global Variables
      • Local Variables
      • Route Variables
      • Session Context
      • Window Variables
    • Actions
      • GraphQL Trigger
      • Refresh Query
      • Set Variable
      • Select and Navigate
  • 🎛️Settings
    • User Authentication
    • Git
    • External Deployment
    • Version Control
    • External DB Setup
    • SEO
Powered by GitBook
On this page
  • React Providers
  • Global Dispatch
  • Dispatch Session Context
  • Dispatch Overlay
  • Dispatch Form
  • Local Context
  • Code Example

Was this helpful?

  1. IDE
  2. Importing Code

Scripts

Use Scripts to manage common logic and and simple data handling for your app

React Providers

By default, the script is executed with these additional parameters in the function to access the context of the application and modify the app behavior.

Global Dispatch

Allow to modify the global context of the application

dispatch.globalDsipatch({
    payload: {
        key: varName,
        value: varValue
    }
})

Dispatch Session Context

Allows you to modify values ​​related to the logged-in user

dispatchSessionContext({
    payload: {
        key: 'user',
        value: 'value'
    }
})

Dispatch Overlay

Allows you to modify values ​​related to the overlay context

dispatchOverlay({
    NameComponent: 'ModalNewProyect'
    destNodeName: 'ModalNewProyect',
    navigation: 'OVERLAY',
    transition: {
        "type": "MOVE_IN",
        "direction": "BOTTOM ",
        "matchLayers": false,
        "easing": {
            "type": "EASE_OUT"
        },
        "duration": 0.30000001192092896
    },
    prototyping: {
        "overlayBackgroundInteraction": "CLOSE_ON_CLICK_OUTSIDE",
        "overlayPositionType": "CENTER",
        "overlayBackground ": {
            "type": "SOLID_COLOR",
            "color": {
                "r": 0,
                "g": 0,
                "b": 0,
                "a": 0.699999988079071
            }
        }
    },
    overlayBackground: 'rgba(0, 0, 0, 0.699999988079071)',
    width: 770,
    height: 344
}, {})

Dispatch Form

Works if the script is being executed inside a Form element, otherwise it will be undefined. Allows you to modify form values ​​eg:

dispatchForm({
    payload: {
        key: 'name',
        value: 'hello'
    }
})

Local Context

You will also have access from this parameter to the localContext of parent elements that are executing the script.

[localContext].dispatch({
    payload: {
        key: 'name',
        value: 'hello'
    }
})

The localContext will have the same name as the name configured in the Figma component with two attributes: state and dispatch.

Attribute
Type
Usage

State

Object

State will have the state of the localContext

dispatch

Object

dispatch will allow to modify the state of the localContext in question

Code Example

Code example using the dispatch object to show an alert in the app window

(dispatch) => {
    window.alert(" hello world! ")
}
PreviousImporting CodeNextManifest

Last updated 1 year ago

Was this helpful?

🤖