This repository was archived by the owner on Oct 1, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 242
feat: enable load callbacks #414
Merged
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
fd80c13
refactor(examples): run ssr example from server
pimlie a1d82d1
chore: switch to babel for build
pimlie bc3d384
feat: enable loaded callbacks
pimlie 9806500
examples: add async-callback browser example
pimlie 3a4d729
examples: fix server
pimlie 2469b68
examples(ssr): add reactive script with callback
pimlie 374ac5e
fix: also skip on ssr
pimlie 46ef040
chore: remove unused var
pimlie ab80965
feat: only add mutationobserver if DOM is still loading
pimlie 22225fc
examples: pass vmid to loadCallback instead of el
pimlie 3bef064
feat: also support load callbacks for link/style tags
pimlie e06ac1b
test: add unit tests for load
pimlie c033c3c
test: add load e2e test
pimlie b44f2fb
chore: fix lint
pimlie 071e83c
chore: remove unused files
pimlie d6819c0
test: fix e2e load callback test
pimlie 6ad2de7
test: fix attempt
pimlie 0f1a10b
examples: ie9 compatiblity
pimlie 414708c
fix: add onload attribute on ssr
pimlie e77edfd
chore: lint ci conf
pimlie d6141de
refactor: remove loadCallbackAttribute config option
pimlie 995b7e7
test: improve coverage
pimlie bc9e0f1
fix: only use console when it exists (for ie9)
pimlie 9e50b87
chore: fix coverage
pimlie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -134,5 +134,3 @@ workflows: | |
| requires: [test-e2e-ssr] | ||
| filters: | ||
| branches: { ignore: /^pull\/.*/ } | ||
|
|
||
|
|
||
File renamed without changes.
This file contains hidden or 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 hidden or 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 @@ | ||
| window.users.push({ | ||
| 'id': 1, | ||
| 'name': 'Leanne Graham', | ||
| 'username': 'Bret', | ||
| 'email': 'Sincere@april.biz', | ||
| 'address': { | ||
| 'street': 'Kulas Light', | ||
| 'suite': 'Apt. 556', | ||
| 'city': 'Gwenborough', | ||
| 'zipcode': '92998-3874', | ||
| 'geo': { | ||
| 'lat': '-37.3159', | ||
| 'lng': '81.1496' | ||
| } | ||
| }, | ||
| 'phone': '1-770-736-8031 x56442', | ||
| 'website': 'hildegard.org', | ||
| 'company': { | ||
| 'name': 'Romaguera-Crona', | ||
| 'catchPhrase': 'Multi-layered client-server neural-net', | ||
| 'bs': 'harness real-time e-markets' | ||
| } | ||
| }) |
This file contains hidden or 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 @@ | ||
| window.users.push({ | ||
| 'id': 2, | ||
| 'name': 'Ervin Howell', | ||
| 'username': 'Antonette', | ||
| 'email': 'Shanna@melissa.tv', | ||
| 'address': { | ||
| 'street': 'Victor Plains', | ||
| 'suite': 'Suite 879', | ||
| 'city': 'Wisokyburgh', | ||
| 'zipcode': '90566-7771', | ||
| 'geo': { | ||
| 'lat': '-43.9509', | ||
| 'lng': '-34.4618' | ||
| } | ||
| }, | ||
| 'phone': '010-692-6593 x09125', | ||
| 'website': 'anastasia.net', | ||
| 'company': { | ||
| 'name': 'Deckow-Crist', | ||
| 'catchPhrase': 'Proactive didactic contingency', | ||
| 'bs': 'synergize scalable supply-chains' | ||
| } | ||
| }) |
This file contains hidden or 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 @@ | ||
| window.users.push({ | ||
| 'id': 3, | ||
| 'name': 'Clementine Bauch', | ||
| 'username': 'Samantha', | ||
| 'email': 'Nathan@yesenia.net', | ||
| 'address': { | ||
| 'street': 'Douglas Extension', | ||
| 'suite': 'Suite 847', | ||
| 'city': 'McKenziehaven', | ||
| 'zipcode': '59590-4157', | ||
| 'geo': { | ||
| 'lat': '-68.6102', | ||
| 'lng': '-47.0653' | ||
| } | ||
| }, | ||
| 'phone': '1-463-123-4447', | ||
| 'website': 'ramiro.info', | ||
| 'company': { | ||
| 'name': 'Romaguera-Jacobson', | ||
| 'catchPhrase': 'Face to face bifurcated interface', | ||
| 'bs': 'e-enable strategic applications' | ||
| } | ||
| }) |
This file contains hidden or 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 @@ | ||
| window.users.push({ | ||
| 'id': 4, | ||
| 'name': 'Patricia Lebsack', | ||
| 'username': 'Karianne', | ||
| 'email': 'Julianne.OConner@kory.org', | ||
| 'address': { | ||
| 'street': 'Hoeger Mall', | ||
| 'suite': 'Apt. 692', | ||
| 'city': 'South Elvis', | ||
| 'zipcode': '53919-4257', | ||
| 'geo': { | ||
| 'lat': '29.4572', | ||
| 'lng': '-164.2990' | ||
| } | ||
| }, | ||
| 'phone': '493-170-9623 x156', | ||
| 'website': 'kale.biz', | ||
| 'company': { | ||
| 'name': 'Robel-Corkery', | ||
| 'catchPhrase': 'Multi-tiered zero tolerance productivity', | ||
| 'bs': 'transition cutting-edge web services' | ||
| } | ||
| }) |
This file contains hidden or 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,88 @@ | ||
| import Vue from 'vue' | ||
| import VueMeta from 'vue-meta' | ||
|
|
||
| Vue.use(VueMeta) | ||
|
|
||
| window.users = [] | ||
|
|
||
| new Vue({ | ||
| metaInfo () { | ||
| return { | ||
| title: 'Async Callback', | ||
| titleTemplate: '%s | Vue Meta Examples', | ||
| script: [ | ||
| { | ||
| skip: this.count < 2, | ||
| vmid: 'potatoes', | ||
| src: '/user-3.js', | ||
| async: true, | ||
| callback: this.updateCounter | ||
| }, | ||
| { | ||
| skip: this.count < 1, | ||
| vmid: 'vegetables', | ||
| src: '/user-2.js', | ||
| async: true, | ||
| callback: this.updateCounter | ||
| }, | ||
| { | ||
| vmid: 'meat', | ||
| src: '/user-1.js', | ||
| async: true, | ||
| callback: el => this.loadCallback(el.getAttribute('data-vmid')) | ||
| }, | ||
| ...this.scripts | ||
| ] | ||
| } | ||
| }, | ||
| data () { | ||
| return { | ||
| count: 0, | ||
| scripts: [], | ||
| users: window.users | ||
| } | ||
| }, | ||
| watch: { | ||
| count (val) { | ||
| if (val === 3) { | ||
| this.addScript() | ||
| } | ||
| } | ||
| }, | ||
| methods: { | ||
| updateCounter () { | ||
| this.count++ | ||
| }, | ||
| addScript () { | ||
| this.scripts.push({ | ||
| src: '/user-4.js', | ||
| callback: () => { | ||
| this.updateCounter() | ||
| } | ||
| }) | ||
| }, | ||
| loadCallback (vmid) { | ||
| if (vmid === 'meat') { | ||
| this.updateCounter() | ||
| } | ||
| } | ||
| }, | ||
| template: ` | ||
| <div id="app"> | ||
| <h1>Async Callback</h1> | ||
| <p>{{ count }} scripts loaded</p> | ||
|
|
||
| <div> | ||
| <h2>Users</h2> | ||
| <ul> | ||
| <li | ||
| v-for="user in users" | ||
| :key="user.id" | ||
| > | ||
| <strong>{{ user.id }}</strong>: {{ user.name }} | ||
| </li> | ||
| </ul> | ||
| </div> | ||
| </div> | ||
| ` | ||
| }).$mount('#app') | ||
This file contains hidden or 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,13 @@ | ||
| <!DOCTYPE html> | ||
| <html> | ||
| <head> | ||
| <title>Async Callback Title</title> | ||
| <link rel="stylesheet" href="/global.css"> | ||
| </head> | ||
| <body> | ||
| <a href="/">← Examples index</a> | ||
| <div id="app"></div> | ||
|
|
||
| <script src="/__build__/async-callback.js"></script> | ||
| </body> | ||
| </html> |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.