Skip to content

Commit a294965

Browse files
authored
Merge pull request #14 from captainbook/main
Async load
2 parents 56a8608 + dad2b91 commit a294965

File tree

4 files changed

+11
-15
lines changed

4 files changed

+11
-15
lines changed

public/css/laravel-tel-input.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
.iti{width:100%}
1+
.iti { width: 100%; }

public/js/laravel-tel-input.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/js/laravel-tel-input.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
/**
2-
* International Telephone Input
3-
*/
4-
if (typeof window.intlTelInput !== 'function') {
5-
throw new TypeError(
6-
'Laravel-Tel-Input: requires International Telephone Input (https://github.com/jackocnr/intl-tel-input). Please install with NPM or include the CDN.'
7-
);
8-
}
9-
101
// LaravelTelInput
112
(function () {
123

@@ -268,6 +259,11 @@
268259

269260
function renderTelInput()
270261
{
262+
if (typeof window.intlTelInput !== 'function') {
263+
throw new TypeError(
264+
'Laravel-Tel-Input: requires International Telephone Input (https://github.com/jackocnr/intl-tel-input). Please install with NPM or include the CDN.'
265+
);
266+
}
271267
// Call function to initialize an instance of int tel input on all elements with .iti--laravel-tel-input attribute
272268
const telInputconfig = laravelTelInputConfig; // laravelTelInputConfig will be defined in blade
273269
const telInputs = document.querySelectorAll(".iti--laravel-tel-input");

resources/views/assets.blade.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
@isset($cssPath)
44
<style>{!! file_get_contents($cssPath) !!}</style>
55
@endisset
6-
6+
77
@elseif($type == 'scripts')
88

99
@isset($jsPath)
10-
<script>
11-
var laravelTelInputConfig = @json(config('laravel-tel-input.options'));
12-
{!! file_get_contents($jsPath) !!}
10+
<script async>
11+
var laravelTelInputConfig = @json(config('laravel-tel-input.options'));
12+
{!! file_get_contents($jsPath) !!}
1313
</script>
1414
@endisset
1515

0 commit comments

Comments
 (0)