Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
forked fromvuejs/vue

Commitc5d0fa0

Browse files
committed
feat: make vue and basic server renderer compatible in pure js runtimes
1 parent093673e commitc5d0fa0

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

‎src/platforms/web/runtime/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Vue.prototype.$mount = function (
4444

4545
// devtools global hook
4646
/* istanbul ignore next */
47-
setTimeout(()=>{
47+
Vue.nextTick(()=>{
4848
if(config.devtools){
4949
if(devtools){
5050
devtools.emit('init',Vue)

‎src/platforms/web/runtime/transition-util.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,11 @@ if (hasTransition) {
5858
}
5959

6060
// binding to window is necessary to make hot reload work in IE in strict mode
61-
constraf=inBrowser&&window.requestAnimationFrame
62-
?window.requestAnimationFrame.bind(window)
63-
:setTimeout
61+
constraf=inBrowser
62+
?window.requestAnimationFrame
63+
?window.requestAnimationFrame.bind(window)
64+
:setTimeout
65+
:/* istanbul ignore next */fn=>fn()
6466

6567
exportfunctionnextFrame(fn:Function){
6668
raf(()=>{

‎src/server/write.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
/*@flow */
22

33
constMAX_STACK_DEPTH=1000
4+
constnoop=_=>_
5+
6+
constdefer=typeofprocess!=='undefined'&&process.nextTick
7+
?process.nextTick
8+
:typeofPromise!=='undefined'
9+
?fn=>Promise.resolve().then(fn)
10+
:typeofsetTimeout!=='undefined'
11+
?setTimeout
12+
:noop
13+
14+
if(defer===noop){
15+
thrownewError(
16+
'Your JavaScript runtime does not support any asynchronous primitives '+
17+
'that are required by vue-server-renderer. Please use a polyfill for '+
18+
'either Promise or setTimeout.'
19+
)
20+
}
421

522
exportfunctioncreateWriteFunction(
623
write:(text:string,next:Function)=>boolean,
@@ -14,7 +31,7 @@ export function createWriteFunction (
1431
constwaitForNext=write(text,next)
1532
if(waitForNext!==true){
1633
if(stackDepth>=MAX_STACK_DEPTH){
17-
process.nextTick(()=>{
34+
defer(()=>{
1835
try{next()}catch(e){
1936
onError(e)
2037
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp