SmartJS has a lot of content planning, and it cannot be completed in a short time. At present, it is accumulated in small versions.
The content released in the first issue of 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's callbacks, but has functions such as result delivery, priority, event parameters, promise control, etc.
2. Trigger
Trigger, apply the trigger (aop) function on the object, the target object will have method injection function (based on promiseEvent). The injection types include before, after and round surroundings;
3. FlowController
Process/lifecycle controller, controls the execution and flow of processes, based on Trigger
4. Common methods;
//Merge the default data method to copy the content of obj from defObj; it does not work with jquery's $.extend, and only adds non-existent data.
st.mergeObj(deep, obj, defObj, exclude)
//Inject method into the target object method and return the result
st.injectFn(target, name, fn, before,stopOnFalse)
//Merge the method and return the result
st.mergeFn(fn, mergeFn, stopOnFalse)
I would like to make a statement, I am very sorry, the smartUI 2.0 I promised to have not been completed, my ideas have been changing, and I have found that I can control less and less time in the past two years. However, there will also be ui content in the subsequent planning of smartjs, which is equivalent to combining smartUI into Smartjs.
Post-production trailer: In smartjs version 0.2, some content supported by OOP will be added.
Finally, the address of the smart address is attached, which contains a rich variety of test cases. For APIs, the blog will be updated one by one.