1"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[5026],{74302:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>a,contentTitle:()=>o,default:()=>u,frontMatter:()=>s,metadata:()=>c,toc:()=>l});var t=r(85893),i=r(11151);const s={sidebar_position:4,description:"Wrapper for a function to make it can receive self as an argument.",toc_max_heading_level:2},o="touying-fn-wrapper",c={id:"reference/core/touying-fn-wrapper",title:"touying-fn-wrapper",description:"Wrapper for a function to make it can receive self as an argument.",source:"@site/docs/reference/core/touying-fn-wrapper.mdx",sourceDirName:"reference/core",slug:"/reference/core/touying-fn-wrapper",permalink:"/docs/reference/core/touying-fn-wrapper",draft:!1,unlisted:!1,tags:[],version:"current",sidebarPosition:4,frontMatter:{sidebar_position:4,description:"Wrapper for a function to make it can receive self as an argument.",toc_max_heading_level:2},sidebar:"tutorialSidebar",previous:{title:"touying-recall",permalink:"/docs/reference/core/touying-recall"},next:{title:"touying-slide-wrapper",permalink:"/docs/reference/core/touying-slide-wrapper"}},a={},l=[{value:"fn : <TypeLink></TypeLink>",id:"fn",level:3},{value:"last-subslide : <TypeLink></TypeLink> <Default><code>none</code></Default>",id:"last-subslide",level:3},{value:"repetitions : <TypeLink></TypeLink> <Default><code>none</code></Default>",id:"repetitions",level:3}];function d(e){const n={a:"a",code:"code",h1:"h1",h3:"h3",p:"p",strong:"strong",...(0,i.a)(),...e.components},{Default:r,Param:s,Parameters:o,Signature:c,SignatureName:a,SignatureParam:l,SourceLink:d,TypeLink:u}=n;return r||p("Default",!0),s||p("Param",!0),o||p("Parameters",!0),c||p("Signature",!0),a||p("SignatureName",!0),l||p("SignatureParam",!0),d||p("SourceLink",!0),u||p("TypeLink",!0),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h1,{id:"touying-fn-wrapper",children:"touying-fn-wrapper"}),"\n",(0,t.jsx)(c,{children:(0,t.jsxs)("code",{children:[(0,t.jsx)(a,{children:"touying-fn-wrapper"}),"(",(0,t.jsxs)(l,{children:[(0,t.jsx)(n.a,{href:"#fn",children:"fn"}),", "]}),(0,t.jsxs)(l,{children:[(0,t.jsx)(n.a,{href:"#last-subslide",children:"last-subslide: none"}),", "]}),(0,t.jsxs)(l,{children:[(0,t.jsx)(n.a,{href:"#repetitions",children:"repetitions: none"}),", "]}),(0,t.jsx)(l,{children:(0,t.jsx)(n.a,{href:"#args",children:"..args"})}),")",(0,t.jsx)(d,{href:"https://github.com/touying-typ/touying/blob/main/src/core.typ#L1133"})]})}),"\n",(0,t.jsxs)(n.p,{children:["Wrapper for a function to make it can receive ",(0,t.jsx)(n.code,{children:"self"})," as an argument.\nIt is useful when you want to use ",(0,t.jsx)(n.code,{children:"self"})," to get current subslide index, like ",(0,t.jsx)(n.code,{children:"uncover"})," and ",(0,t.jsx)(n.code,{children:"only"})," functions."]}),"\n",(0,t.jsxs)(n.p,{children:["Example: ",(0,t.jsx)(n.code,{children:"#let alternatives = touying-fn-wrapper.with(utils.alternatives)"})]}),"\n",(0,t.jsxs)(o,{children:[(0,t.jsxs)(n.h3,{id:"fn",children:["fn : ",(0,t.jsx)(u,{type:"function"})]}),(0,t.jsx)(s,{children:(0,t.jsxs)(n.p,{children:["The function that will be called like ",(0,t.jsx)(n.code,{children:"(self: none, ..args) => { .. }"}),"."]})}),(0,t.jsxs)(n.h3,{id:"last-subslide",children:["last-subslide : ",(0,t.jsx)(u,{type:"int"})," ",(0,t.jsx)(r,{children:(0,t.jsx)(n.code,{children:"none"})})]}),(0,t.jsx)(s,{children:(0,t.jsxs)(n.p,{children:["The max subslide count for the slide. Used by functions like ",(0,t.jsx)(n.code,{children:"uncover"}),", ",(0,t.jsx)(n.code,{children:"only"}),", and ",(0,t.jsx)(n.code,{children:"alternatives-match"})," to determine the total number of subslides needed."]})}),(0,t.jsxs)(n.h3,{id:"repetitions",children:["repetitions : ",(0,t.jsx)(u,{type:"function"})," ",(0,t.jsx)(r,{children:(0,t.jsx)(n.code,{children:"none"})})]}),(0,t.jsx)(s,{children:(0,t.jsxs)(n.p,{children:["The repetitions for the function. It is useful for functions like ",(0,t.jsx)(n.code,{children:"alternatives"})," with ",(0,t.jsx)(n.code,{children:"start: auto"}),". It accepts a ",(0,t.jsx)(n.code,{children:"(repetitions, args)"})," and should return a (nextrepetitions, extra-args)."]})})]}),"\n",(0,t.jsxs)(n.p,{children:[(0,t.jsx)(n.strong,{children:"Returns:"})," ",(0,t.jsx)(u,{type:"content"})]})]})}function u(e={}){const{wrapper:n}={...(0,i.a)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(d,{...e})}):d(e)}function p(e,n){throw new Error("Expected "+(n?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}},11151:(e,n,r)=>{r.d(n,{Z:()=>c,a:()=>o});var t=r(67294);const i={},s=t.createContext(i);function o(e){const n=t.useContext(s);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:o(e.components),t.createElement(s.Provider,{value:n},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.