forked from Ittai/ittai
parent
73921078ca
commit
9cd3dee3ef
@ -0,0 +1,133 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Ittai Patching After</title>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/run_prettify.js"></script>
|
||||
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
|
||||
<script src="./build/entry.js"></script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link href="https://fonts.googleapis.com/css?family=Roboto:100,400,700|Inconsolata,700" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
|
||||
<link type="text/css" rel="stylesheet" href="https://jmblog.github.io/color-themes-for-google-code-prettify/themes/tomorrow-night.min.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/app.min.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/iframe.css">
|
||||
<link type="text/css" rel="stylesheet" href="jsdoc.css">
|
||||
<script async defer src="https://buttons.github.io/buttons.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
|
||||
|
||||
<body class="layout small-header">
|
||||
<div id="stickyNavbarOverlay"></div>
|
||||
|
||||
|
||||
<div class="top-nav">
|
||||
<div class="inner">
|
||||
<a id="hamburger" role="button" class="navbar-burger" aria-label="menu" aria-expanded="false">
|
||||
<span aria-hidden="true"></span>
|
||||
<span aria-hidden="true"></span>
|
||||
<span aria-hidden="true"></span>
|
||||
</a>
|
||||
<div class="logo">
|
||||
|
||||
|
||||
<a href="index.html">
|
||||
<h1 class="navbar-item">Ittai Documentation</h1>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
<div class="menu">
|
||||
|
||||
<div class="navigation">
|
||||
<a
|
||||
href="index.html"
|
||||
class="link"
|
||||
>
|
||||
API Documentation
|
||||
</a>
|
||||
|
||||
<div class="dropdown is-hoverable is-right">
|
||||
<a class="dropdown-trigger link">
|
||||
Tutorials
|
||||
<i class="fas fa-chevron-down fa-xs"></i>
|
||||
</a>
|
||||
<div class="dropdown-menu">
|
||||
<div class="dropdown-content">
|
||||
|
||||
<a class="dropdown-item" href="tutorial-patching.html">
|
||||
Patching Functions
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a
|
||||
class="link user-link "
|
||||
href="https://github.com/Kyza/ittai"
|
||||
>
|
||||
GitHub
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="main">
|
||||
<div
|
||||
class="sidebar tutorials"
|
||||
id="sidebarNav"
|
||||
>
|
||||
|
||||
<div class="search-wrapper">
|
||||
<input id="search" type="text" placeholder="Search docs..." class="input">
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
|
||||
<div class="category"><h3>Tutorials</h3><ul><li><a href="tutorial-patching.html">Patching Functions</a><ul><li><a href="tutorial-patching-before.html">Patching Before</a></li><li><a href="tutorial-patching-instead.html">Patching Instead</a></li><li><a href="tutorial-patching-after.html">Patching After</a></li></ul></li></ul></div>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
<div class="core" id="main-content-wrapper">
|
||||
<div class="content">
|
||||
<header class="page-title">
|
||||
<p>Tutorial</p>
|
||||
<h1>Patching After</h1>
|
||||
</header>
|
||||
<section>
|
||||
|
||||
<article>
|
||||
<p>bruh</p>
|
||||
</article>
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div id="side-nav" class="side-nav">
|
||||
</div>
|
||||
</div>
|
||||
<script src="scripts/app.min.js"></script>
|
||||
<script>PR.prettyPrint();</script>
|
||||
<script src="scripts/linenumber.js"> </script>
|
||||
|
||||
<script src="scripts/search.js"> </script>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,133 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Ittai Patching Before</title>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/run_prettify.js"></script>
|
||||
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
|
||||
<script src="./build/entry.js"></script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link href="https://fonts.googleapis.com/css?family=Roboto:100,400,700|Inconsolata,700" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
|
||||
<link type="text/css" rel="stylesheet" href="https://jmblog.github.io/color-themes-for-google-code-prettify/themes/tomorrow-night.min.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/app.min.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/iframe.css">
|
||||
<link type="text/css" rel="stylesheet" href="jsdoc.css">
|
||||
<script async defer src="https://buttons.github.io/buttons.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
|
||||
|
||||
<body class="layout small-header">
|
||||
<div id="stickyNavbarOverlay"></div>
|
||||
|
||||
|
||||
<div class="top-nav">
|
||||
<div class="inner">
|
||||
<a id="hamburger" role="button" class="navbar-burger" aria-label="menu" aria-expanded="false">
|
||||
<span aria-hidden="true"></span>
|
||||
<span aria-hidden="true"></span>
|
||||
<span aria-hidden="true"></span>
|
||||
</a>
|
||||
<div class="logo">
|
||||
|
||||
|
||||
<a href="index.html">
|
||||
<h1 class="navbar-item">Ittai Documentation</h1>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
<div class="menu">
|
||||
|
||||
<div class="navigation">
|
||||
<a
|
||||
href="index.html"
|
||||
class="link"
|
||||
>
|
||||
API Documentation
|
||||
</a>
|
||||
|
||||
<div class="dropdown is-hoverable is-right">
|
||||
<a class="dropdown-trigger link">
|
||||
Tutorials
|
||||
<i class="fas fa-chevron-down fa-xs"></i>
|
||||
</a>
|
||||
<div class="dropdown-menu">
|
||||
<div class="dropdown-content">
|
||||
|
||||
<a class="dropdown-item" href="tutorial-patching.html">
|
||||
Patching Functions
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a
|
||||
class="link user-link "
|
||||
href="https://github.com/Kyza/ittai"
|
||||
>
|
||||
GitHub
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="main">
|
||||
<div
|
||||
class="sidebar tutorials"
|
||||
id="sidebarNav"
|
||||
>
|
||||
|
||||
<div class="search-wrapper">
|
||||
<input id="search" type="text" placeholder="Search docs..." class="input">
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
|
||||
<div class="category"><h3>Tutorials</h3><ul><li><a href="tutorial-patching.html">Patching Functions</a><ul><li><a href="tutorial-patching-before.html">Patching Before</a></li><li><a href="tutorial-patching-instead.html">Patching Instead</a></li><li><a href="tutorial-patching-after.html">Patching After</a></li></ul></li></ul></div>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
<div class="core" id="main-content-wrapper">
|
||||
<div class="content">
|
||||
<header class="page-title">
|
||||
<p>Tutorial</p>
|
||||
<h1>Patching Before</h1>
|
||||
</header>
|
||||
<section>
|
||||
|
||||
<article>
|
||||
<p>bruh</p>
|
||||
</article>
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div id="side-nav" class="side-nav">
|
||||
</div>
|
||||
</div>
|
||||
<script src="scripts/app.min.js"></script>
|
||||
<script>PR.prettyPrint();</script>
|
||||
<script src="scripts/linenumber.js"> </script>
|
||||
|
||||
<script src="scripts/search.js"> </script>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,133 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Ittai Patching Instead</title>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/run_prettify.js"></script>
|
||||
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
|
||||
<script src="./build/entry.js"></script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link href="https://fonts.googleapis.com/css?family=Roboto:100,400,700|Inconsolata,700" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
|
||||
<link type="text/css" rel="stylesheet" href="https://jmblog.github.io/color-themes-for-google-code-prettify/themes/tomorrow-night.min.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/app.min.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/iframe.css">
|
||||
<link type="text/css" rel="stylesheet" href="jsdoc.css">
|
||||
<script async defer src="https://buttons.github.io/buttons.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
|
||||
|
||||
<body class="layout small-header">
|
||||
<div id="stickyNavbarOverlay"></div>
|
||||
|
||||
|
||||
<div class="top-nav">
|
||||
<div class="inner">
|
||||
<a id="hamburger" role="button" class="navbar-burger" aria-label="menu" aria-expanded="false">
|
||||
<span aria-hidden="true"></span>
|
||||
<span aria-hidden="true"></span>
|
||||
<span aria-hidden="true"></span>
|
||||
</a>
|
||||
<div class="logo">
|
||||
|
||||
|
||||
<a href="index.html">
|
||||
<h1 class="navbar-item">Ittai Documentation</h1>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
<div class="menu">
|
||||
|
||||
<div class="navigation">
|
||||
<a
|
||||
href="index.html"
|
||||
class="link"
|
||||
>
|
||||
API Documentation
|
||||
</a>
|
||||
|
||||
<div class="dropdown is-hoverable is-right">
|
||||
<a class="dropdown-trigger link">
|
||||
Tutorials
|
||||
<i class="fas fa-chevron-down fa-xs"></i>
|
||||
</a>
|
||||
<div class="dropdown-menu">
|
||||
<div class="dropdown-content">
|
||||
|
||||
<a class="dropdown-item" href="tutorial-patching.html">
|
||||
Patching Functions
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a
|
||||
class="link user-link "
|
||||
href="https://github.com/Kyza/ittai"
|
||||
>
|
||||
GitHub
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="main">
|
||||
<div
|
||||
class="sidebar tutorials"
|
||||
id="sidebarNav"
|
||||
>
|
||||
|
||||
<div class="search-wrapper">
|
||||
<input id="search" type="text" placeholder="Search docs..." class="input">
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
|
||||
<div class="category"><h3>Tutorials</h3><ul><li><a href="tutorial-patching.html">Patching Functions</a><ul><li><a href="tutorial-patching-before.html">Patching Before</a></li><li><a href="tutorial-patching-instead.html">Patching Instead</a></li><li><a href="tutorial-patching-after.html">Patching After</a></li></ul></li></ul></div>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
<div class="core" id="main-content-wrapper">
|
||||
<div class="content">
|
||||
<header class="page-title">
|
||||
<p>Tutorial</p>
|
||||
<h1>Patching Instead</h1>
|
||||
</header>
|
||||
<section>
|
||||
|
||||
<article>
|
||||
<p>bruh</p>
|
||||
</article>
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div id="side-nav" class="side-nav">
|
||||
</div>
|
||||
</div>
|
||||
<script src="scripts/app.min.js"></script>
|
||||
<script>PR.prettyPrint();</script>
|
||||
<script src="scripts/linenumber.js"> </script>
|
||||
|
||||
<script src="scripts/search.js"> </script>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,178 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Ittai Patching Functions</title>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/run_prettify.js"></script>
|
||||
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
|
||||
<script src="./build/entry.js"></script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link href="https://fonts.googleapis.com/css?family=Roboto:100,400,700|Inconsolata,700" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
|
||||
<link type="text/css" rel="stylesheet" href="https://jmblog.github.io/color-themes-for-google-code-prettify/themes/tomorrow-night.min.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/app.min.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/iframe.css">
|
||||
<link type="text/css" rel="stylesheet" href="jsdoc.css">
|
||||
<script async defer src="https://buttons.github.io/buttons.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
|
||||
|
||||
<body class="layout small-header">
|
||||
<div id="stickyNavbarOverlay"></div>
|
||||
|
||||
|
||||
<div class="top-nav">
|
||||
<div class="inner">
|
||||
<a id="hamburger" role="button" class="navbar-burger" aria-label="menu" aria-expanded="false">
|
||||
<span aria-hidden="true"></span>
|
||||
<span aria-hidden="true"></span>
|
||||
<span aria-hidden="true"></span>
|
||||
</a>
|
||||
<div class="logo">
|
||||
|
||||
|
||||
<a href="index.html">
|
||||
<h1 class="navbar-item">Ittai Documentation</h1>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
<div class="menu">
|
||||
|
||||
<div class="navigation">
|
||||
<a
|
||||
href="index.html"
|
||||
class="link"
|
||||
>
|
||||
API Documentation
|
||||
</a>
|
||||
|
||||
<div class="dropdown is-hoverable is-right">
|
||||
<a class="dropdown-trigger link">
|
||||
Tutorials
|
||||
<i class="fas fa-chevron-down fa-xs"></i>
|
||||
</a>
|
||||
<div class="dropdown-menu">
|
||||
<div class="dropdown-content">
|
||||
|
||||
<a class="dropdown-item" href="tutorial-patching.html">
|
||||
Patching Functions
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a
|
||||
class="link user-link "
|
||||
href="https://github.com/Kyza/ittai"
|
||||
>
|
||||
GitHub
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="main">
|
||||
<div
|
||||
class="sidebar tutorials"
|
||||
id="sidebarNav"
|
||||
>
|
||||
|
||||
<div class="search-wrapper">
|
||||
<input id="search" type="text" placeholder="Search docs..." class="input">
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
|
||||
<div class="category"><h3>Tutorials</h3><ul><li><a href="tutorial-patching.html">Patching Functions</a><ul><li><a href="tutorial-patchingBefore.html">Patching Before</a></li><li><a href="tutorial-patchingInstead.html">Patching Instead</a></li><li><a href="tutorial-patchingAfter.html">Patching After</a></li></ul></li></ul></div>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
<div class="core" id="main-content-wrapper">
|
||||
<div class="content">
|
||||
<header class="page-title">
|
||||
<p>Tutorial</p>
|
||||
<h1>Patching Functions</h1>
|
||||
</header>
|
||||
<section>
|
||||
|
||||
<article>
|
||||
<p><a href="module-utils_patcher.html#.patch"><code>Patch</code></a>ing functions is a common way to inject code into Discord. Ittai provides three types of patches.</p>
|
||||
<ul>
|
||||
<li><a href="module-utils_patcher.html#.before"><code>Before</code></a> runs your code before the function is executed.</li>
|
||||
<li><a href="module-utils_patcher.html#.instead"><code>Instead</code></a> Runs your code instead of the function.</li>
|
||||
<li><a href="module-utils_patcher.html#.after"><code>After</code></a> runs your code after the function is executed.</li>
|
||||
</ul>
|
||||
<p><a href="module-utils_patcher.html#.before"><code>module:utils/patcher.before</code></a>, <a href="module-utils_patcher.html#.instead"><code>utils/patcher.instead</code></a>, and <a href="module-utils_patcher.html#.after"><code>module:utils/patcher.after</code></a> are also shorthand functions available in the patcher.</p>
|
||||
<p>Ittai will automatically unpatch all of your functions when the plugin stops, so no need to worry about forgetting and leaving a patch hanging in the void.</p>
|
||||
<p>Here's a basic example of how to use Ittai's patcher.</p>
|
||||
<pre class="prettyprint source lang-js"><code>const obj = {
|
||||
f: () => {
|
||||
console.log("x");
|
||||
},
|
||||
};
|
||||
|
||||
/*
|
||||
* x
|
||||
*/
|
||||
obj.f();
|
||||
|
||||
// Patch the function and save the patch for later.
|
||||
const beforePatch = ittai.utils.patcher.patch(
|
||||
"patch-test",
|
||||
obj,
|
||||
"f",
|
||||
"before",
|
||||
() => {
|
||||
console.log("Before patch!");
|
||||
}
|
||||
);
|
||||
|
||||
/*
|
||||
* Before patch!
|
||||
* x
|
||||
*/
|
||||
obj.f();
|
||||
|
||||
// Unpatch the function.
|
||||
beforePatch.unpatch();
|
||||
|
||||
/*
|
||||
* x
|
||||
*/
|
||||
obj.f();
|
||||
</code></pre>
|
||||
<p>You can also add multiple patches and combine patches of different types together.</p>
|
||||
</article>
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div id="side-nav" class="side-nav">
|
||||
</div>
|
||||
</div>
|
||||
<script src="scripts/app.min.js"></script>
|
||||
<script>PR.prettyPrint();</script>
|
||||
<script src="scripts/linenumber.js"> </script>
|
||||
|
||||
<script src="scripts/search.js"> </script>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,162 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Ittai Patching After</title>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/run_prettify.js"></script>
|
||||
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
|
||||
<script src="./build/entry.js"></script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link href="https://fonts.googleapis.com/css?family=Roboto:100,400,700|Inconsolata,700" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
|
||||
<link type="text/css" rel="stylesheet" href="https://jmblog.github.io/color-themes-for-google-code-prettify/themes/tomorrow-night.min.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/app.min.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/iframe.css">
|
||||
<link type="text/css" rel="stylesheet" href="jsdoc.css">
|
||||
<script async defer src="https://buttons.github.io/buttons.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
|
||||
|
||||
<body class="layout small-header">
|
||||
<div id="stickyNavbarOverlay"></div>
|
||||
|
||||
|
||||
<div class="top-nav">
|
||||
<div class="inner">
|
||||
<a id="hamburger" role="button" class="navbar-burger" aria-label="menu" aria-expanded="false">
|
||||
<span aria-hidden="true"></span>
|
||||
<span aria-hidden="true"></span>
|
||||
<span aria-hidden="true"></span>
|
||||
</a>
|
||||
<div class="logo">
|
||||
|
||||
|
||||
<a href="index.html">
|
||||
<h1 class="navbar-item">Ittai Documentation</h1>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
<div class="menu">
|
||||
|
||||
<div class="navigation">
|
||||
<a
|
||||
href="index.html"
|
||||
class="link"
|
||||
>
|
||||
API Documentation
|
||||
</a>
|
||||
|
||||
<div class="dropdown is-hoverable is-right">
|
||||
<a class="dropdown-trigger link">
|
||||
Tutorials
|
||||
<i class="fas fa-chevron-down fa-xs"></i>
|
||||
</a>
|
||||
<div class="dropdown-menu">
|
||||
<div class="dropdown-content">
|
||||
|
||||
<a class="dropdown-item" href="tutorial-patching.html">
|
||||
Patching Functions
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a
|
||||
class="link user-link "
|
||||
href="https://github.com/Kyza/ittai"
|
||||
>
|
||||
GitHub
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="main">
|
||||
<div
|
||||
class="sidebar tutorials"
|
||||
id="sidebarNav"
|
||||
>
|
||||
|
||||
<div class="search-wrapper">
|
||||
<input id="search" type="text" placeholder="Search docs..." class="input">
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
|
||||
<div class="category"><h3>Tutorials</h3><ul><li><a href="tutorial-patching.html">Patching Functions</a><ul><li><a href="tutorial-patchingBefore.html">Patching Before</a></li><li><a href="tutorial-patchingInstead.html">Patching Instead</a></li><li><a href="tutorial-patchingAfter.html">Patching After</a></li></ul></li></ul></div>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
<div class="core" id="main-content-wrapper">
|
||||
<div class="content">
|
||||
<header class="page-title">
|
||||
<p>Tutorial</p>
|
||||
<h1>Patching After</h1>
|
||||
</header>
|
||||
<section>
|
||||
|
||||
<article>
|
||||
<pre class="prettyprint source lang-js"><code>const obj = {
|
||||
f: () => {
|
||||
console.log("x");
|
||||
},
|
||||
};
|
||||
|
||||
/*
|
||||
* x
|
||||
*/
|
||||
obj.f();
|
||||
|
||||
// Patch the function and save the patch for later.
|
||||
const afterPatch = ittai.utils.patcher.after("patch-test", obj, "f", () => {
|
||||
console.log("After patch!");
|
||||
});
|
||||
|
||||
/*
|
||||
* x
|
||||
* After patch!
|
||||
*/
|
||||
obj.f();
|
||||
|
||||
// Unpatch the function.
|
||||
afterPatch.unpatch();
|
||||
|
||||
/*
|
||||
* x
|
||||
*/
|
||||
obj.f();
|
||||
</code></pre>
|
||||
</article>
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div id="side-nav" class="side-nav">
|
||||
</div>
|
||||
</div>
|
||||
<script src="scripts/app.min.js"></script>
|
||||
<script>PR.prettyPrint();</script>
|
||||
<script src="scripts/linenumber.js"> </script>
|
||||
|
||||
<script src="scripts/search.js"> </script>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,162 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Ittai Patching Before</title>
|
||||
|
||||