Skip to content
  • 📢 PSA: Scripts are out, modules are in.

    World javascript webdev
    4
    1
    0 Votes
    4 Posts
    14 Views
    illdredI
    @sir_pepe where can I learn more about the "deterministic order" feature?
  • 0 Votes
    2 Posts
    25 Views
    mccM
    @lukaszkups Because1. That would be expensive, and require money.2. Open source volunteer communities are consistently better at developing tools for coders than artists.3. Webtech is generally worse at what Flash wants to do than Flash was (as duct taped together as the proprietary Flash interpreters were), which increases the friction of the task.
  • Why I 🧡 the web.

    World javascript games oldschool
    2
    1
    0 Votes
    2 Posts
    29 Views
    MB/MasterBroNetworkM
    @davidbisset Never played Super Monkey Ball, but I love this trend of porting old games to the web, I think there's one of DOOM as well?
  • 0 Votes
    1 Posts
    32 Views
    Fabio NevesF
    I'm migrating from another instance, so it's #introduction time again!I'm Fabio, a software developer originally from #Brazil based in Toronto. I work mostly with #Ruby and #Javascript but I'm always trying new languages and stacks.I'm very much an #AI skeptic – borderline hater when it comes to AI "art". Yes, I know the tools, hence my opinion.I make music sometimes using #Ableton, #DirtyWaveM8, #PolyendTracker and I also play live #drumsI'm openly #queer, #bisexual and #AntiFascist
  • I'm officially a curmudgeon.

    World webdev css html javascript
    18
    0 Votes
    18 Posts
    93 Views
    Paul HebertP
    @noleli it’s definitely a balancing act!
  • 0 Votes
    4 Posts
    46 Views
    洪 民憙 (Hong Minhee) :nonbinary:H
    @[email protected] @[email protected] I think it's partly because JavaScript is more commonly used for building consumer products compared to other languages, so there's a higher proportion of developers focused on shipping products rather than diving deep into infrastructure. When you're building a product, you naturally extract just enough to solve your immediate problem and move on. Languages like Rust tend to attract more developers interested in tooling and infrastructure work, where yak shaving is almost expected. The ecosystem reflects the priorities of its community.
  • 0 Votes
    1 Posts
    42 Views
    洪 民憙 (Hong Minhee)H
    This post did not contain any content.
  • 0 Votes
    1 Posts
    21 Views
    Thinking ElixirT
    News includes Arcana #RAG library for Phoenix, MquickjsEx embedding #JavaScript in #ElixirLang, LiveDebugger adds Streams support, Durable workflow engine, @josevalim teasing type improvements, Hologram receiving @TheErlef support, and more! @elixirlang https://www.youtube.com/watch?v=cULPRZTUWZQ
  • 0 Votes
    1 Posts
    29 Views
    LobstersL
    Your CLI's completion should know what options you've already typed by @hongminhee https://lobste.rs/s/5se1tq #javascript #programminghttps://hackers.pub/@hongminhee/2026/optique-context-aware-cli-completion
  • 2 Votes
    1 Posts
    39 Views
    洪 民憙 (Hong Minhee)H
    This post did not contain any content.
  • 0 Votes
    1 Posts
    50 Views
    洪 民憙 (Hong Minhee)H
    Consider Git's -C option: git -C /path/to/repo checkout <TAB> When you hit <kbd>Tab</kbd>, Git completes branch names from /path/to/repo, not your current directory. The completion is context-aware—it depends on the value of another option. Most CLI parsers can't do this. They treat each option in isolation, so completion for --branch has no way of knowing the --repo value. You end up with two unpleasant choices: either show completions for all possible branches across all repositories (useless), or give up on completion entirely for these options. Optique 0.10.0 introduces a dependency system that solves this problem while preserving full type safety. Static dependencies with or() Optique already handles certain kinds of dependent options via the or() combinator: import { flag, object, option, or, string } from "@optique/core"; const outputOptions = or( object({ json: flag("--json"), pretty: flag("--pretty"), }), object({ csv: flag("--csv"), delimiter: option("--delimiter", string()), }), ); TypeScript knows that if json is true, you'll have a pretty field, and if csv is true, you'll have a delimiter field. The parser enforces this at runtime, and shell completion will suggest --pretty only when --json is present. This works well when the valid combinations are known at definition time. But it can't handle cases where valid values depend on runtime input—like branch names that vary by repository. Runtime dependencies Common scenarios include: A deployment CLI where --environment affects which services are available A database tool where --connection affects which tables can be completed A cloud CLI where --project affects which resources are shown In each case, you can't know the valid values until you know what the user typed for the dependency option. Optique 0.10.0 introduces dependency() and derive() to handle exactly this. The dependency system The core idea is simple: mark one option as a dependency source, then create derived parsers that use its value. import { choice, dependency, message, object, option, string, } from "@optique/core"; function getRefsFromRepo(repoPath: string): string[] { // In real code, this would read from the Git repository return ["main", "develop", "feature/login"]; } // Mark as a dependency source const repoParser = dependency(string()); // Create a derived parser const refParser = repoParser.derive({ metavar: "REF", factory: (repoPath) => { const refs = getRefsFromRepo(repoPath); return choice(refs); }, defaultValue: () => ".", }); const parser = object({ repo: option("--repo", repoParser, { description: message`Path to the repository`, }), ref: option("--ref", refParser, { description: message`Git reference`, }), }); The factory function is where the dependency gets resolved. It receives the actual value the user provided for --repo and returns a parser that validates against refs from that specific repository. Under the hood, Optique uses a three-phase parsing strategy: Parse all options in a first pass, collecting dependency values Call factory functions with the collected values to create concrete parsers Re-parse derived options using those dynamically created parsers This means both validation and completion work correctly—if the user has already typed --repo /some/path, the --ref completion will show refs from that path. Repository-aware completion with @optique/git The @optique/git package provides async value parsers that read from Git repositories. Combined with the dependency system, you can build CLIs with repository-aware completion: import { command, dependency, message, object, option, string, } from "@optique/core"; import { gitBranch } from "@optique/git"; const repoParser = dependency(string()); const branchParser = repoParser.deriveAsync({ metavar: "BRANCH", factory: (repoPath) => gitBranch({ dir: repoPath }), defaultValue: () => ".", }); const checkout = command( "checkout", object({ repo: option("--repo", repoParser, { description: message`Path to the repository`, }), branch: option("--branch", branchParser, { description: message`Branch to checkout`, }), }), ); Now when you type my-cli checkout --repo /path/to/project --branch <TAB>, the completion will show branches from /path/to/project. The defaultValue of "." means that if --repo isn't specified, it falls back to the current directory. Multiple dependencies Sometimes a parser needs values from multiple options. The deriveFrom() function handles this: import { choice, dependency, deriveFrom, message, object, option, } from "@optique/core"; function getAvailableServices(env: string, region: string): string[] { return [`${env}-api-${region}`, `${env}-web-${region}`]; } const envParser = dependency(choice(["dev", "staging", "prod"] as const)); const regionParser = dependency(choice(["us-east", "eu-west"] as const)); const serviceParser = deriveFrom({ dependencies: [envParser, regionParser] as const, metavar: "SERVICE", factory: (env, region) => { const services = getAvailableServices(env, region); return choice(services); }, defaultValues: () => ["dev", "us-east"] as const, }); const parser = object({ env: option("--env", envParser, { description: message`Deployment environment`, }), region: option("--region", regionParser, { description: message`Cloud region`, }), service: option("--service", serviceParser, { description: message`Service to deploy`, }), }); The factory receives values in the same order as the dependency array. If some dependencies aren't provided, Optique uses the defaultValues. Async support Real-world dependency resolution often involves I/O—reading from Git repositories, querying APIs, accessing databases. Optique provides async variants for these cases: import { dependency, string } from "@optique/core"; import { gitBranch } from "@optique/git"; const repoParser = dependency(string()); const branchParser = repoParser.deriveAsync({ metavar: "BRANCH", factory: (repoPath) => gitBranch({ dir: repoPath }), defaultValue: () => ".", }); The @optique/git package uses isomorphic-git under the hood, so gitBranch(), gitTag(), and gitRef() all work in both Node.js and Deno. There's also deriveSync() for when you need to be explicit about synchronous behavior, and deriveFromAsync() for multiple async dependencies. Wrapping up The dependency system lets you build CLIs where options are aware of each other—not just for validation, but for shell completion too. You get type safety throughout: TypeScript knows the relationship between your dependency sources and derived parsers, and invalid combinations are caught at compile time. This is particularly useful for tools that interact with external systems where the set of valid values isn't known until runtime. Git repositories, cloud providers, databases, container registries—anywhere the completion choices depend on context the user has already provided. This feature will be available in Optique 0.10.0. To try the pre-release: deno add jsr:@optique/[email protected] Or with npm: npm install @optique/[email protected] See the documentation for more details.
  • switch(true) gotcha

    General Discussion javascript
    6
    3 Votes
    6 Posts
    1k Views
    julianJ
    @[email protected] there is, and it'd work in this case. The issue is that as the condition is evaluated, if it doesn't resolve to boolean true, then the case won't execute. In the example above it resolves (in JavaScript, anyway) to "bar"
  • 1 Votes
    4 Posts
    894 Views
    julianJ
    @[email protected] glad to hear it! NodeBB is also built on Javascript (Node.js, specifically), and @[email protected] is using Deno (but also works on Node, I think @[email protected]?) Would you be interested in using a helper library to get you started quicker? Stuff like HTTP signatures (signing and validating), collection generation logic, etc?
  • 0 Votes
    2 Posts
    397 Views
    julianJ
    @[email protected] Thanks for elucidating this so succinctly. It's a sentiment towards javascript development that I've held for nearly a decade. 13 years ago we were joking about whether technology X was "web scale", and hundreds of developers drank the valley kool-aid and went all-in on building objectively simple CRUD apps using the most complicated kitchen-sink frameworks that required multiple developers to maintain and extend. The unix philosophy of doing one thing and doing it well, still holds true to this day.
  • 0 Votes
    5 Posts
    2k Views
    DownPWD
    While waiting for version 3.5.0 which will add the new containers, we have solved the problem like this (with the help of @phenomlab ) if ($(window).width() <= 991) { // Check if the custom thread view button already exists in the bottom bar //$buttonContainer = $('.bottombar-nav.p-2.text-dark.bg-light.d-flex.justify-content-between.align-items-center.w-100'); if ($("#logged-in-menu").length > 0) { var buttonContainer = $('.bottombar-nav ul#logged-in-menu'); } else { var buttonContainer = $('.bottombar-nav ul#logged-out-menu'); } // Prepend the button to the selected container buttonContainer.prepend(threadViewButton); }
  • 0 Votes
    3 Posts
    1k Views
    Sebastián CisnerosS
    @PitaJ said in How to call API from client side.: require(['api', 'translator'], (api, translator) => { // Your code here }); genius! and fast reply!
  • 0 Votes
    1 Posts
    954 Views
    ufan0U
    As mentioned in the title, I want to add some javascripts and html to my post. For example, I want to show data by calling api in a specific post. I tried the plugin -> markdown ->Allow HTML, it does not work.It seems will ban the javascript. So is there any good way to meet my needs? Thanks s lot. [image: 1622046490458-006hl0sxgy1g9xjkxn77rj30j60j6who.jpg]
  • 0 Votes
    3 Posts
    1k Views
    <baris>B
    Did you try with this? function onLoad() { require(['/assets/uploads/readmore.min.js'], function () { console.log('yeah it works'); console.log($('blockquote')); $('blockquote').readmore(); }); } $(document).ready(onLoad); $(window).on('action:ajaxify.end', onLoad);
  • How to make custom JS persist

    Technical Support javascript plugin spa scrolling
    5
    0 Votes
    5 Posts
    2k Views
    phenomlabP
    @dogs this worked a treat - thanks. For anyone else who might be looking for something similar, here's a simple scroll to top function that you can place into your Custom JS // Scroll to top button $(window).on('action:ajaxify.end', function(data) { var btn = $('#btt'); $(window).scroll(function() { if ($(window).scrollTop() > 300) { btn.addClass('show'); } else { btn.removeClass('show'); } }); btn.on('click', function(e) { e.preventDefault(); $('html, body').animate({scrollTop:0}, '300'); }); }) Then place this into your Custom Header <a id="btt"><i class="fas fa-chevron-up"></i></a> Obviously, you would need to provide some CSS to style this. An example of this can be found on https://phenomlab.com
  • 2 Votes
    4 Posts
    2k Views
    dogsD
    @dunlix yeah you should! what does discord have to do with it? I tried using that link with different values and URL of course on my site, still didn't work. I'm sure it works for you, what am I missing? To be honest: Nothing. I am building a plugin for Discord integration..So the variable names are just placeholders if you want so. The important part is at the end of my main post. I hope that you find a slick way to use it for your community maybe.

Looks like your connection to NodeBB Community was lost, please wait while we try to reconnect.