First met the three swordsmen of smartjs aop
- 2020-03-30 03:15:47
- OfStack
SmartJS content planning is more, also can not be completed in a short time, is currently a small version of a function accumulation.
1. PromiseEvent
Callback management based on events and promises, similar to jquery callbacks, but with results passing, priority, event parameters, promise control, and more
2. The Trigger
Trigger, applying trigger (aop) functionality to an object, the target object will have method injection (based on promiseEvent), and the injection types are before, after, and round.
3. FlowController
Process/lifecycle controller, which controls the execution and flow of processes, based on Trigger
4. Common methods;
// merge the default data method to copy the hollow obj content from defObj; It doesn't work with jquery's $.extend and only adds data that doesn't exist
St. mergeObj (deep, obj, defObj, exclude)
// injects the method into the target object method and returns the result
St. injectFn (target, name, fn, before, stopOnFalse)
// merge methods and return the result
St. mergeFn (fn, mergeFn stopOnFalse)
By the way, I'm sorry that the promised smartUI2.0 has not been completed, ideas have been changing, and I've found myself with less and less time on my hands over the past two years. However, smartjs will also have UI aspects in the future planning, which is equivalent to smartUI and smartjs.
Finally, I have attached the address smart, which contains rich test cases. If the API is updated, the blog will explain one by one.