Overview

更新时间:
复制 MD 格式

Every valuable application has robust business logic. This logic creates complex interactions, defines business rules, and connects the interface to data. This topic defines logic development and explains its core concepts on the Mobi platform.

What is logic development

Logic development is the process where developers use visual configurations or code to define an application's interaction flows and behavioral logic. This enables the application to process and respond to user input, such as a button click, or other system events, such as a successful backend API call. The application can then perform a corresponding action, such as refreshing a component or displaying a message.

On the Mobi low-code development platform, most standard logic can be built with simple visual configurations. This improves developer efficiency and reduces communication and maintenance costs. For complex or custom business logic, Mobi also provides code-level features that developers are familiar with, such as expressions and frontend functions. These features offer greater flexibility and control while still improving efficiency.

Core concepts of logic development

Event

An event is a notification mechanism in application development. It informs the application when a user performs an action or when the system state changes. Developers create and define event handlers to respond to specific events. This allows developers to implement event-driven business logic.

Expression

An expression is a code snippet that performs calculations, conditional checks, and data processing. It uses a short syntax, returns a value, and can be embedded directly into configuration items and template strings. Developers use expressions to handle simple logic and data transformation tasks without writing complex code.

Variable

A variable provides temporary data storage and access for the application logic. It is used to share and pass data between different logic units. Developers define and use variables to manage data dynamically and maintain state. Similar to variables in programming languages, they have a scope and a data type.

Frontend function

A frontend function is a data object that executes a JavaScript script in the browser. You can use it to implement complex business logic, including side effects and asynchronous operations. Because a frontend function is a named object, it is reusable and can be called from multiple locations.

Computed property

A computed property is a JavaScript script that contains data transformation logic. The return value of the script becomes the value of the computed property. When the data that a computed property depends on changes, the property updates automatically. Defining computed properties simplifies logic development and helps manage complex data transformations and dependencies.

Timer

Timers provide a way to create and manage periodic tasks in an application. With a timer, code can run automatically at specified intervals to perform operations such as updating data or sending notifications.