Home > Web Front-end > JS Tutorial > body text

First introduction to SmartJS - AOP Three Musketeers_Others

WBOY
Release: 2016-05-16 16:45:19
Original
1186 people have browsed it

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.

Related labels:
aop
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template