简体   繁体   中英

Write a simple zepto plugin

I'm writing a couple of simple zepto plugins that I would like to use in my application:

https://github.com/Pherserk/symfony2_demo_article_feed/tree/partial/feature-user-creation/src/AppBundle/Resources/public/js/JsonApiAjax.js

https://github.com/Pherserk/symfony2_demo_article_feed/tree/partial/feature-user-creation/src/AppBundle/Resources/public/js/JwtAjax.js

Including the zepto library and the two files above I get the error TypeError: $.JwtAjax is not a function

Here is the code of the page calling it:

https://github.com/Pherserk/symfony2_demo_article_feed/blob/partial/feature-user-creation/src/AppBundle/Resources/views/Web/Main/writeArticle.html.twig

Any help would be appreciated.

I was missing this:

$.JwtToken = $.fn.JwtToken;

That is declaring the function a the level of the $ namespace as alias of the function defintion at $.fn namespace.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM