File tree Expand file tree Collapse file tree 3 files changed +10
-4
lines changed
example/unicorn/templates/unicorn Expand file tree Collapse file tree 3 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,13 @@ export class Element {
4545 this . model . debounceTime = attribute . modifiers . debounce ? parseInt ( attribute . modifiers . debounce , 10 ) || - 1 : - 1 ;
4646 } else if ( attribute . isPoll ) {
4747 this . poll . method = attribute . value ? attribute . value : "refresh" ;
48- this . poll . timing = parseInt ( Object . keys ( attribute . modifiers ) [ 0 ] , 10 ) || 2000 ;
48+ this . poll . timing = 2000 ;
49+
50+ const pollArgs = attribute . name . split ( "-" ) . slice ( 1 ) ;
51+
52+ if ( pollArgs . length > 0 ) {
53+ this . poll . timing = parseInt ( pollArgs [ 0 ] , 10 ) || 2000 ;
54+ }
4955 } else if ( attribute . eventType ) {
5056 const action = { } ;
5157 action . name = attribute . value ;
Original file line number Diff line number Diff line change 1- < div unicorn:poll. 1000 ="get_date ">
1+ < div unicorn:poll- 1000 ="get_date ">
22 < input unicorn:model ="date_example " type ="text " id ="dateExampleId ">
33 date_example: {{ date_example }} | {{ date_example|date:"s" }}< br />
44</ div >
Original file line number Diff line number Diff line change @@ -9,8 +9,8 @@ test("poll", (t) => {
99 t . is ( element . poll . timing , 2000 ) ;
1010} ) ;
1111
12- test ( "poll. 1000" , ( t ) => {
13- const html = "<div unicorn:poll. 1000='test()'></div>" ;
12+ test ( "poll- 1000" , ( t ) => {
13+ const html = "<div unicorn:poll- 1000='test()'></div>" ;
1414 const element = getElement ( html ) ;
1515
1616 t . is ( element . poll . timing , 1000 ) ;
You can’t perform that action at this time.
0 commit comments