Skip to content

usefulteam/wordpress__customize-browser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wp.customize typings

Credits

This package is a "copy-then-modify" version of @types/wordpress__customize-browser. These definitions were written by Marek Dědič

Intro

This package contains typings for the WordPress Customizer JavaScript API. The typings were recreated by reading the source code, which is very complicated and so the typings may contain mistakes. Additionally, there are some TODOs - usually places where any was used because of a lack of understanding of the API. Feel free to propose a PR fixing any of those.

Usage

The package adds type-checking to the built-in functions, so you can just use something like

wp.customize.section('nav').deactivate({
    completeCallback: () => {
        wp.customize.section('colors').activate(); // show after nav hides completely
    },
});

However, if you want to use the types directly, they are exported under the wordpress__customize namespace, so, rewriting the same to use a function:

function fun(section: wordpress__customize.Section): void {
  section.deactivate({
    completeCallback: () => {
        wp.customize.section('colors').activate(); // show after nav hides completely
    },
  });
}

wp.customize.section('nav', fun);

About

Typescript types of wp.customize

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published