-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
91 additions
and
0 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
19 changes: 19 additions & 0 deletions
19
demo/app/samples/experimental/adapter-pause-resume.component.html
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,19 @@ | ||
<app-demo [datasource]="datasource" [context]="demoContext" [sources]="sources"> | ||
<div actions> | ||
<div class="comment">Available since v3.2.0, undocumented</div> | ||
<button (click)="datasource.adapter.pause()">Pause</button> | ||
<button (click)="datasource.adapter.resume()">Resume</button> | ||
</div> | ||
<div description> | ||
<p> | ||
The <em>Adapter.pause</em> method is to stop the Scroller. | ||
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. | ||
</p> | ||
<p> | ||
The <em>Adapter.resume</em> method is to make the Scroller live again. | ||
</p> | ||
</div> | ||
</app-demo> |
64 changes: 64 additions & 0 deletions
64
demo/app/samples/experimental/adapter-pause-resume.component.ts
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,64 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
import { demos } from '../../routes'; | ||
import { DemoSources, DemoSourceType, MyItem } from '../../shared/interfaces'; | ||
|
||
import { Datasource } from 'ngx-ui-scroll'; | ||
|
||
@Component({ | ||
selector: 'app-adapter-pause-resume', | ||
templateUrl: './adapter-pause-resume.component.html' | ||
}) | ||
export class DemoAdapterPauseResumeComponent { | ||
demoContext = { | ||
config: demos.experimental.map.adapterPauseResume, | ||
noInfo: true | ||
}; | ||
|
||
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 }); | ||
} | ||
success(data); | ||
}, | ||
devSettings: { | ||
debug: true | ||
} | ||
}); | ||
|
||
sources: DemoSources = [ | ||
{ | ||
active: true, | ||
name: DemoSourceType.Template, | ||
text: `<button (click)="datasource.adapter.pause()">Pause</button> | ||
<button (click)="datasource.adapter.resume()">Resume</button> | ||
<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`; | ||
} |