Skip to content

Commit

Permalink
Merge pull request #14 from captainbook/main
Browse files Browse the repository at this point in the history
Async load
  • Loading branch information
victorybiz authored Aug 24, 2022
2 parents 56a8608 + dad2b91 commit a294965
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 15 deletions.
2 changes: 1 addition & 1 deletion public/css/laravel-tel-input.css
Original file line number Diff line number Diff line change
@@ -1 +1 @@
.iti{width:100%}
.iti { width: 100%; }
2 changes: 1 addition & 1 deletion public/js/laravel-tel-input.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 5 additions & 9 deletions resources/js/laravel-tel-input.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
/**
* International Telephone Input
*/
if (typeof window.intlTelInput !== 'function') {
throw new TypeError(
'Laravel-Tel-Input: requires International Telephone Input (https://github.com/jackocnr/intl-tel-input). Please install with NPM or include the CDN.'
);
}

// LaravelTelInput
(function () {

Expand Down Expand Up @@ -268,6 +259,11 @@

function renderTelInput()
{
if (typeof window.intlTelInput !== 'function') {
throw new TypeError(
'Laravel-Tel-Input: requires International Telephone Input (https://github.com/jackocnr/intl-tel-input). Please install with NPM or include the CDN.'
);
}
// Call function to initialize an instance of int tel input on all elements with .iti--laravel-tel-input attribute
const telInputconfig = laravelTelInputConfig; // laravelTelInputConfig will be defined in blade
const telInputs = document.querySelectorAll(".iti--laravel-tel-input");
Expand Down
8 changes: 4 additions & 4 deletions resources/views/assets.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
@isset($cssPath)
<style>{!! file_get_contents($cssPath) !!}</style>
@endisset

@elseif($type == 'scripts')

@isset($jsPath)
<script>
var laravelTelInputConfig = @json(config('laravel-tel-input.options'));
{!! file_get_contents($jsPath) !!}
<script async>
var laravelTelInputConfig = @json(config('laravel-tel-input.options'));
{!! file_get_contents($jsPath) !!}
</script>
@endisset

Expand Down

0 comments on commit a294965

Please sign in to comment.