Skip to content

Commit 8e2dbb2

Browse files
committed
[demo] Update demo for Fix #144 [context-generator] Rename method -> oldMethod, cachedMethod -> method, keeping cachedMethod as an alias for method
1 parent 9ea063d commit 8e2dbb2

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

demo/hook-callback.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -1572,7 +1572,7 @@ Copyright (c) 2017, Tetsuya Mori <[email protected]>. All rights reserved.
15721572
function *gen() {}
15731573
switch (f) {
15741574
case Function:
1575-
args = hook.FunctionArguments('__hook__', [[context, {}]], 'cachedMethod', args);
1575+
args = hook.FunctionArguments('__hook__', [[context, {}]], 'method', args);
15761576
break;
15771577
case '()':
15781578
switch (thisArg) {
@@ -1582,14 +1582,14 @@ Copyright (c) 2017, Tetsuya Mori <[email protected]>. All rights reserved.
15821582
if (args[1]) {
15831583
switch (args[1][0]) {
15841584
case Function:
1585-
args1 = [args[1][0], hook.FunctionArguments('__hook__', [[context, {}]], 'cachedMethod', args[1][1])];
1585+
args1 = [args[1][0], hook.FunctionArguments('__hook__', [[context, {}]], 'method', args[1][1])];
15861586
if (args[1][2]) {
15871587
args1.push(args[1][2]);
15881588
}
15891589
break;
15901590
default:
15911591
if (args[1][0].prototype instanceof Function) {
1592-
args1 = [args[1][0], hook.FunctionArguments('__hook__', [[context, {}]], 'cachedMethod', args[1][1], args[1][0].prototype.constructor === gen.constructor)];
1592+
args1 = [args[1][0], hook.FunctionArguments('__hook__', [[context, {}]], 'method', args[1][1], args[1][0].prototype.constructor === gen.constructor)];
15931593
if (args[1][2]) {
15941594
args1.push(args[1][2]);
15951595
}
@@ -1602,7 +1602,7 @@ Copyright (c) 2017, Tetsuya Mori <[email protected]>. All rights reserved.
16021602
if (args[1]) {
16031603
switch (args[1][0]) {
16041604
case Function:
1605-
args1 = [args[1][0], args[1][1], hook.FunctionArguments('__hook__', [[context, {}]], 'cachedMethod', args[1][2])];
1605+
args1 = [args[1][0], args[1][1], hook.FunctionArguments('__hook__', [[context, {}]], 'method', args[1][2])];
16061606
break;
16071607
default:
16081608
break;
@@ -1623,11 +1623,11 @@ Copyright (c) 2017, Tetsuya Mori <[email protected]>. All rights reserved.
16231623
default:
16241624
if (typeof f === 'function') {
16251625
if (f.prototype instanceof Function && newTarget) {
1626-
args = hook.FunctionArguments('__hook__', [[context, {}]], 'cachedMethod', args, f.prototype.constructor === gen.constructor);
1626+
args = hook.FunctionArguments('__hook__', [[context, {}]], 'method', args, f.prototype.constructor === gen.constructor);
16271627
}
16281628
else if (newTarget === '') {
16291629
if (args[0] && Object.getPrototypeOf(args[0]) === Function) {
1630-
args = [ args[0], ...hook.FunctionArguments('__hook__', [[context, {}]], 'cachedMethod', args.slice(1)) ];
1630+
args = [ args[0], ...hook.FunctionArguments('__hook__', [[context, {}]], 'method', args.slice(1)) ];
16311631
}
16321632
}
16331633
}

demo/hook-native-api.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Copyright (c) 2017, Tetsuya Mori <[email protected]>. All rights reserved.
1515
'Document'
1616
].forEach((name) => {
1717
if (_global[name]) {
18-
hook.hook(hook[name]('__hook__', [[name, {}]], 'cachedMethod'));
18+
hook.hook(hook[name]('__hook__', [[name, {}]], 'method'));
1919
}
2020
});
2121
//hook.global(__hook__, 'hook-native-api.js', 'Function', 'set')._pp_Function = hook.global(__hook__, 'hook-native-api.js', 'Function', 'get')._pp_Function;

demo/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<html lang="en">
1616
<head>
1717
<meta charset="utf-8">
18-
<script src="../../thin-hook/hook.min.js?version=446&no-hook-authorization=c3a79b39ec09b39b7aacfe913843ec404868f5837319a3a309030ea137527a5c,b4795c4a780458f69141026f5530680dbba9061cedbb0ec93e3b536b1cdad98e,5fbc3f3ee20085b3a20e3b5844cf0626b5f7b3d97644cb349878a9e76c834620,log-no-hook-authorization&sw-root=/&no-hook=true&hook-name=__hook__&context-generator-name=method&discard-hook-errors=false&fallback-page=index-fb.html&hook-property=true&hook-global=true&hook-prefix=_pp_&compact=true&service-worker-ready=false"></script></head></html><!--
18+
<script src="../../thin-hook/hook.min.js?version=446&no-hook-authorization=c3a79b39ec09b39b7aacfe913843ec404868f5837319a3a309030ea137527a5c,1c6af8fcfbdb7865daf1ec7c53730544f7dea0cbf4d0029ee2f109bcfdd431a3,5fbc3f3ee20085b3a20e3b5844cf0626b5f7b3d97644cb349878a9e76c834620,log-no-hook-authorization&sw-root=/&no-hook=true&hook-name=__hook__&context-generator-name=method&discard-hook-errors=false&fallback-page=index-fb.html&hook-property=true&hook-global=true&hook-prefix=_pp_&compact=true&service-worker-ready=false"></script></head></html><!--
1919
<script context-generator src="no-hook-authorization.js?no-hook=true"></script>
2020
<script context-generator src="context-generator.js?no-hook=true"></script>
2121
<script context-generator no-hook>

demo/original-index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<html lang="en">
1616
<head>
1717
<meta charset="utf-8">
18-
<script src="../../thin-hook/hook.min.js?version=446&no-hook-authorization=c3a79b39ec09b39b7aacfe913843ec404868f5837319a3a309030ea137527a5c,b4795c4a780458f69141026f5530680dbba9061cedbb0ec93e3b536b1cdad98e,5fbc3f3ee20085b3a20e3b5844cf0626b5f7b3d97644cb349878a9e76c834620,log-no-hook-authorization&sw-root=/&no-hook=true&hook-name=__hook__&context-generator-name=method&discard-hook-errors=false&fallback-page=index-fb.html&hook-property=true&hook-global=true&hook-prefix=_pp_&compact=true&service-worker-ready=true"></script>
18+
<script src="../../thin-hook/hook.min.js?version=446&no-hook-authorization=c3a79b39ec09b39b7aacfe913843ec404868f5837319a3a309030ea137527a5c,1c6af8fcfbdb7865daf1ec7c53730544f7dea0cbf4d0029ee2f109bcfdd431a3,5fbc3f3ee20085b3a20e3b5844cf0626b5f7b3d97644cb349878a9e76c834620,log-no-hook-authorization&sw-root=/&no-hook=true&hook-name=__hook__&context-generator-name=method&discard-hook-errors=false&fallback-page=index-fb.html&hook-property=true&hook-global=true&hook-prefix=_pp_&compact=true&service-worker-ready=true"></script>
1919
<script context-generator src="no-hook-authorization.js?no-hook=true"></script>
2020
<script context-generator src="context-generator.js?no-hook=true"></script>
2121
<script context-generator no-hook>

0 commit comments

Comments
 (0)