I am developing an administration interface with graphics and so on, and I am using the Highcharts library (140kb). I want this file to be downloaded only for admin users. What would be the best way to do this?
I just saw that we can use Iron-Router to conditionally load JavaScript , but I don't like the idea of ββhandling such things inside the router, as shown below:
Router.map -> @route 'admin', path: '/admin' template: 'admin' action: -> $.getScript '/js/moment.min.js', (data, textStatus, jqxhr) -> if jqxhr.status is 200 @render()
NOTE . I wrote a short blog post to download the library only for specific users using Meteor. p>
( )?
var loaded = false; Deps.autorun(function() { if (!loaded && isAdmin(Meteor.userId())) { $.getScript("/js/moment.min.js"); loaded = true; } });
Source: https://habr.com/ru/post/1546548/More articles:How to protect MQTT from websockets - securityDisable Spinner drop-down when focus changes - androidAutomatically display a form when opening a template file, dotm from explorer - vbajQuery Owl Carousel: how to make the current slide focused - jqueryget / set property by expression - c #Programmatically add a servlet to a built-in grizzly - jerseyΠΠΈΠ½Π°ΠΌΠΈΡΠ΅ΡΠΊΠΎΠ΅ Π²ΡΡΠ°ΠΆΠ΅Π½ΠΈΠ΅ ΠΈΠ· ΡΠ²ΠΎΠΉΡΡΠ²Π° ΠΎΠ±ΡΠ΅ΠΊΡΠ° ΠΊΠ»Π°ΡΡΠ° - c#Handle response with unexpected content type as application / json? - scalaGenerate CTAGS for libstdC ++ (from the current GCC) - c ++ΠΡΠ΅Π΄ΡΡΠ°Π²Π»Π΅Π½ΠΈΠ΅ ΡΠΈΡΠ΅Π» Π€ΠΈΠ±ΠΎΠ½Π°ΡΡΠΈ Ρ ΠΈΡΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°Π½ΠΈΠ΅ΠΌ ΠΏΠΎΠ½ΠΈΠΌΠ°Π½ΠΈΡ ΡΠΏΠΈΡΠΊΠ° Π² Haskell - haskellAll Articles