Home Web Front-end JS Tutorial First introduction to SmartJS - AOP Three Musketeers_Others

First introduction to SmartJS - AOP Three Musketeers_Others

May 16, 2016 pm 04:45 PM
aop

SmartJS has a lot of content planning, and it cannot be completed in a short time. Currently, the functions are accumulated one by one in small versions.

The content released in the first version 0.1 is mainly to implement some support for front-end aspect-oriented programming (AOP).

1. PromiseEvent

Callback management based on events and promises, similar to jquery callbacks, but with functions such as result delivery, priority, event parameters, promise control, etc.

 2. Trigger

Trigger, apply trigger (aop) function on the object, the target object will have method injection function (based on promiseEvent), the injection types are before, after and round;

 3. FlowController

Process/life cycle controller, controls the execution and flow of the process, based on Trigger

 4. Commonly used methods;

//Merge the default data method, copy the empty content of obj from defObj; it is not the same as jquery's $.extend, only non-existing data will be added
st.mergeObj(deep, obj, defObj, exclude)

//Inject the method into the target object method and return the result
st.injectFn(target, name, fn, before,stopOnFalse)

 //Merge method, return result
 st.mergeFn(fn, mergeFn,stopOnFalse)

In addition, I would like to state that I am very sorry that the smartUI2.0 promised before has not been completed. My ideas have been changing, and I have found that I have less and less time at my disposal in the past two years. However, smartjs's subsequent planning will also include UI content, which is equivalent to merging smartUI into Smartjs.

Later preview: In smartjs version 0.2, some content supported by oop will be added.

Finally, the smart address is attached, which contains a relatively rich set of test cases. Regarding the API, the blog will be updated to explain them one by one.

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Does go language not support aop? Does go language not support aop? Dec 27, 2022 pm 05:04 PM

The go language supports aop. AOP refers to aspect-oriented programming, which is a technology that achieves unified maintenance of program functions through pre-compilation and dynamic agents during runtime; AOP is an object-oriented approach, with main application scenarios: logging, performance statistics, security control , transaction processing, exception handling, etc.

Springboot uses spel combined with aop to realize dynamic parameter transfer Springboot uses spel combined with aop to realize dynamic parameter transfer May 16, 2023 am 11:49 AM

Introduction to SpEl expressions Before starting to write the code, first understand the SpEl (SpringExpressionLanguage) expression, which is a powerful tool in the Spring framework. Spring can construct complex expressions, access object properties, call object methods, etc. at runtime through SpEl. .A simple example is given to facilitate understanding. As follows //define an expression StringexpressionStr="1+1";ExpressionParserparser=newSpelExpressionParser();Expressionexpression=parser.

How to use AOP framework in PHP How to use AOP framework in PHP May 19, 2023 pm 01:21 PM

AOP (aspect-oriented programming) is a programming idea used to decouple business logic and cross-cutting concerns (such as logs, permissions, etc.). In PHP, using the AOP framework can simplify coding and improve code maintainability and scalability. This article will introduce the basic principles and implementation methods of using the AOP framework in PHP. 1. The concept and principle of AOP. Aspect-oriented programming refers to separating the business logic of the program from cross-cutting concerns and achieving unified management through the AOP framework. Cross-cutting concerns are those that need to occur repeatedly in the program and

Application of IoC and AOP in Java language Application of IoC and AOP in Java language Jun 10, 2023 pm 12:10 PM

In the Java language, IoC (Inversion of Control) and AOP (AspectOriented Programming) are two very important programming ideas and technologies. Their application can greatly improve the maintainability, scalability and reusability of code, thereby helping developers develop and maintain software systems more efficiently. IoC is an object-oriented design pattern, also known as "Dependency Injection"

Java development: How to use AOP to implement aspect-oriented programming Java development: How to use AOP to implement aspect-oriented programming Sep 20, 2023 am 10:55 AM

Java Development: How to Use AOP to Implement Aspect-Oriented Programming Introduction: In the software development process, Aspect-Oriented Programming (AOP for short) is an important programming idea. The main goal of AOP is decoupling, that is, separating the core business of the application from cross-cutting concerns (such as logging, performance monitoring, etc.) to improve the reusability and maintainability of the code. This article will introduce how to use AOP to implement aspect-oriented programming in Java development, and provide

How Springboot+AOP implements time parameter format conversion How Springboot+AOP implements time parameter format conversion May 11, 2023 pm 03:43 PM

Foreword: The time parameters passed from the front end of the scene can be converted into whatever custom time format we want at the back end. Different business scenarios connect with the front end. The basic time parameters of a control are in a fixed format. In order to prevent the front end from converting the format of the time parameters, we made an agreement with the front end and asked them to pass a fixed format. The back end can convert the format according to the needs. That’s it. Effect ① Convert from yyyy-MM-ddHH:mm:ss to yyyy-MM-dd. Use: ② Convert from yyyyMMddHHmmss to yyyy-MM-ddHH:mm:ss. Use: ③ No more examples. In fact, you can do whatever you want. change. Actual pom.xml (aop dependency, lombok dependency): o

How to use AOP and interceptors to implement custom annotations in SpringBoot How to use AOP and interceptors to implement custom annotations in SpringBoot May 29, 2023 pm 07:58 PM

Spring implements custom annotations through interceptor + AOP. Here, the interceptor acts as a method to be executed at the specified annotation. AOP is responsible for weaving the interceptor method and the place where the annotation takes effect (through Dynamic annotation generates proxy class implementation). 1. Introduce related dependencies spring-boot-starter: some core basic dependencies of spring spring-boot-starter-aop: some related dependencies of spring to implement Aop org.springframework.bootspring-boot-starterorg.springframework.bootsp

How to use SpringBoot+Aop to record user operation logs How to use SpringBoot+Aop to record user operation logs May 11, 2023 pm 09:16 PM

1. Design the user operation log table: the corresponding entity class of sys_oper_log is SysOperLog.javaimportcom.baomidou.mybatisplus.annotation.IdType; importcom.baomidou.mybatisplus.annotation.TableId; importio.swagger.annotations.ApiModelProperty; importlombok.Data; importlombok.EqualsAndHashCode ;importlombo

See all articles