Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export default function (count = 10) {
- // @vue/component
- return {
- data () {
- return {
- displayPriority: 0,
- }
- },
- mounted () {
- this.runDisplayPriority()
- },
- methods: {
- runDisplayPriority () {
- const step = () => {
- requestAnimationFrame(() => {
- this.displayPriority++
- if (this.displayPriority < count) {
- step()
- }
- })
- }
- step()
- },
- defer (priority) {
- return this.displayPriority >= priority
- },
- },
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement