説明なし
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

helpers.js 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. const uid = function(){
  2. return Date.now().toString(36) + Math.random().toString(36).substr(2);
  3. }
  4. function loadScript(src) {
  5. return new Promise(function (resolve, reject) {
  6. var s;
  7. s = document.createElement('script');
  8. s.src = src;
  9. s.onload = resolve;
  10. s.onerror = reject;
  11. document.head.appendChild(s);
  12. });
  13. }
  14. function shuffleArray(array) {
  15. for (let i = array.length - 1; i > 0; i--) {
  16. const j = Math.floor(Math.random() * (i + 1));
  17. [array[i], array[j]] = [array[j], array[i]];
  18. }
  19. }
  20. function getCurrencySymbol(value=0) {
  21. let type = 'INR'
  22. if (type) {
  23. const ans = new Intl.NumberFormat('en-IN', { style: 'currency', currency: type }).format(value);;
  24. const res = ans.split(/(\D+)/);
  25. const currencySymbol = res[1];
  26. const amount = res.slice(2,res.length).join('')
  27. return [currencySymbol,amount]
  28. } else {
  29. console.log("errrrrrrrrrrrrrrrrrrrrrrrrr",type);
  30. return ['',0];
  31. }
  32. }
  33. function toasterHelper(type,message){
  34. // toasterOpts()
  35. debugger;
  36. toasterOpts();
  37. Command: toastr[type](message);
  38. function toasterOpts(){
  39. toastr.options = {
  40. "closeButton": true,
  41. "debug": false,
  42. "newestOnTop": true,
  43. "progressBar": true,
  44. "positionClass": "toast-top-center",
  45. "preventDuplicates": true,
  46. "onclick": null,
  47. "showDuration": "300",
  48. "hideDuration": "1000",
  49. "timeOut": "5000",
  50. "extendedTimeOut": "1000",
  51. "showEasing": "swing",
  52. "hideEasing": "linear",
  53. "showMethod": "fadeIn",
  54. "hideMethod": "fadeOut"
  55. }
  56. }
  57. }