-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #352 from dhilt/issue-351-pause-resume-methods
Pause/resume methods
- Loading branch information
Showing
23 changed files
with
232 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<app-demo [datasource]="datasource" [context]="demoContext" [sources]="sources"> | ||
<div actions> | ||
<button (click)="datasource.adapter.pause()">Pause</button> | ||
<button (click)="datasource.adapter.resume()">Resume</button> | ||
Scroller is {{ datasource.adapter.paused ? 'paused' : 'not paused' }} | ||
</div> | ||
<div description> | ||
<p> | ||
The <em>Adapter.pause</em> method is to stop the Scroller. | ||
When paused, it doesn't receive the scroll events from the viewport, | ||
so the scroll events are ignored. Also, all the Adapter methods | ||
(except <em>Adapter.resume</em> and <em>Adapter.reset</em>) don't do anything. | ||
The <em>Adapter.resume</em> method is to make the Scroller live again. | ||
</p> | ||
<p> | ||
In addition to the <em>pause</em>/<em>resume</em> methods, there is | ||
a read-only property, <em>Adapter.paused</em>, that reports whether | ||
the Scroller is paused or not. | ||
Along with the scalar property, there is also a reactive one: | ||
<em>Adapter.paused$</em>. | ||
</p> | ||
</div> | ||
</app-demo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
import { demos } from '../../routes'; | ||
import { DemoSources, DemoSourceType, MyItem } from '../../shared/interfaces'; | ||
import { doLog } from '../../shared/datasource-get'; | ||
|
||
import { Datasource } from 'ngx-ui-scroll'; | ||
|
||
@Component({ | ||
selector: 'app-demo-pause-resume', | ||
templateUrl: './pause-resume.component.html' | ||
}) | ||
export class DemoPauseResumeComponent { | ||
demoContext = { | ||
config: demos.adapterMethods.map.pauseResume, | ||
viewportId: 'pause-resume-viewport', | ||
count: 0, | ||
log: '' | ||
}; | ||
|
||
datasource = new Datasource({ | ||
get: (index, count, success) => { | ||
const data: MyItem[] = []; | ||
for (let i = index; i <= index + count - 1; i++) { | ||
data.push({ id: i, text: 'item #' + i }); | ||
} | ||
doLog(this.demoContext, index, count, data.length); | ||
success(data); | ||
} | ||
}); | ||
|
||
sources: DemoSources = [ | ||
{ | ||
active: true, | ||
name: DemoSourceType.Template, | ||
text: `<button (click)="datasource.adapter.pause()">Pause</button> | ||
<button (click)="datasource.adapter.resume()">Resume</button> | ||
Scroller is {{ datasource.adapter.paused ? 'paused' : 'not paused' }} | ||
<div class="viewport"> | ||
<div *uiScroll="let item of datasource"> | ||
<div class="item">{{item.text}}</div> | ||
</div> | ||
</div>` | ||
}, | ||
{ | ||
name: DemoSourceType.Datasource, | ||
text: `datasource = new Datasource({ | ||
get: (index, count, success) => { | ||
const data = []; | ||
for (let i = index; i <= index + count - 1; i++) { | ||
data.push({ id: i, text: 'item #' + i }); | ||
} | ||
success(data); | ||
} | ||
} | ||
})` | ||
} | ||
]; | ||
|
||
argumentDescription = ` onBeforeClip: (items: { | ||
$index: number, | ||
data: any, | ||
element?: HTMLElement | ||
}[]) => void`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
export default { | ||
name: 'ngx-ui-scroll', | ||
version: '3.2.0-beta' | ||
version: '3.2.0' | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.