Skip to content
| Marketplace
Sign in
Visual Studio Code>Snippets>Oni JavaScript SnippetNew to Visual Studio Code? Get it now.
Oni JavaScript Snippet

Oni JavaScript Snippet

xiaohuoni

|
4,728 installs
| (0) | Free
JavaScript and umi snippet
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Oni JavaScript Snippet

License

Oni JavaScript Snippet for Visual Studio Code

The extension that provide JavaScript and umi snippets for using in Visual Studio Code.

Recommended configurations

To keep snippets to show on the top of suggestions for easy using, use this configuration.

{
	"editor.snippetSuggestions": "top"
}

Snippets

JavaScript Snippets

like: define、forof、forin、foreach、function...

UMI Snippets

[umi-mock] Umi Mock

'/api/hello'(req, res) {
    res.end(`hello ${Math.random()}`);
},

[umi-subscriptions] Umi model subscriptions

setup({ dispatch, history }) {
      return history.listen(({ pathname, query }) => {
        if (pathname === '/') {
          dispatch({ type: 'fetch', payload: query });
        }
      });
},

[umi-effects] Umi model effects

*fetch({ payload: { page = 1 } }, { call, put }) {
      const { data, headers } = yield call(usersService.fetch, { page });
      yield put({
        type: 'save',
        payload: {
          data,
          total: parseInt(headers['x-total-count'], 10),
          page: parseInt(page, 10),
        },
      });
    },

[umi-service] Umi service request

export function create(values) {
  return request('/api/users', {
    method: 'POST',
    body: JSON.stringify(values),
  });
}
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft