UNPKG

@danielkalen/simplybind

Version:

Magically simple, framework-less one-way/two-way data binding for frontend/backend in ~5kb.

32 lines (25 loc) 740 B
new TestSuite 'title': 'Input x100 Update' 'subtitle': 'Update the value of 100 input fields 1,000 times' 'measureMethod': 'sync' 'warmUps': 100 'timesToRun': 1000 'setupFn': (container$)-> @obj = 'prop':'value' currentValue = 0 inputs = ('<input type="text">' for i in [1..100]) @inputs$ = $(inputs.join '') for input in @inputs$ SimplyBind('prop').of(@obj) .to('value').of(input) @getNewValue = ()-> "value#{currentValue++}" container$.append @inputs$ return 'teardownFn': (container$)-> container$.empty() SimplyBind.unBindAll(@obj, true) SimplyBind.unBindAll(input, true) for input in @inputs$ delete @obj delete @inputs$ delete @getNewValue 'testFn': ()-> @obj.prop = @getNewValue()