
Получите бесплатные кредиты на 100 долларов на DigitaloCean:
Присоединяйтесь к нашему разногласию:
Metawrite - это Appwrite SDK с готовыми к компонентам для Svelte / SvelteKit
Этот пакет поддерживается увеличением.
ПРИМЕЧАНИЕ. Версии
xxnозначает некоторые незначительные изменения в документации или типинге.Версии
xnxмогут включать в себя некоторые незначительные нарушения. См. Примечания к выпуску.Версии
nxxмогут включать в себя некоторые серьезные нарушения. См. Примечания к выпуску.
Пакет полностью работает и совместим с Appwrite Server 0.12, Web SDK 6 и Sveltekit. Но люди в настоящее время сталкиваются с трудностями с npm install metawrite . У нас есть готовый и настроенный шаблон SVELTEKIT , который использует MetaWrite, а также может использоваться в качестве изображения Docker, как описано здесь.
Пожалуйста, рассмотрите возможность использования шаблона, это временное
Используя NPM:
npm install metawriteИспользование пряжи:
yarn add metawrite<User /><Create /><Preferences /><RecoverPassword /><Update /><Verification /><AuthEmail /><AuthOAuth2 /><CreateAnonymousSession /><CreateJWT /><MagicURL /><Browser /><CreditCard /><Favicon /><Flag /><Image /><QR /><Collection /><Document /><Storage /><FileList /><File /><Function /><Continents /><Countries /><Currencies /><Languages /><Locale /><PhoneCodes />Вам нужен работает экземпляр Appwrite, чтобы использовать эту библиотеку. Зайдите в https://appwrite.io/docs/installation для получения дополнительных инструкций.
ПСЕДО ПРИМЕР
Обработайте множество уровней асинхровых реляционных данных (и их загрузки и состояний отступления) полностью из стройной наценки.
<!-- 1. ? Appwrite App -->
< Appwrite {... config }>
<!-- 2. ? Get the current user if logged in -->
< User let:user >
< h1 >Hello { user . name }!</ h1 >
<!-- 3. Get all the documents from a collection -->
< Collection collectionId = " 5f56a3035a01f " let:documents >
You have { documents . length } documents.
{ #each documents as document }
<!-- 4. Get a document -->
< Document collectionId = "5f56a3035a01f" documentId ={ document . $id } { document }>
Title: { document . title }
Text: { document . text }
... Должен быть инициализирован и обернуть каждый компонент metawrite .
< script >
import { Appwrite } from ' metawrite ' ;
const config = {
endpoint : ' http://localhost/v1 ' ,
project : ' demo ' ,
locale : ' fr '
};
</ script >
< Appwrite {... config }>...</ Appwrite >| Имя | Описание |
|---|---|
endpoint | Ваша конечная точка Appwrite. @type - {string} |
project | Ваш идентификатор проекта. @type - {string} |
locale | Необязательно локаль пользователей. @type - {string} |
realtime | Необязательно установить пользовательскую конечную точку в реальном времени. По умолчанию так же, как endpoint . @type - {string} |
Регистрирует новую учетную запись.
< script >
import { Create } from ' metawrite ' ;
let email = ' ' ;
let password = ' ' ;
let name = ' ' ;
const success = ( e ) => {
// success callback
// `e` contains the user object
};
const failure = ( e ) => {
// failure callback
};
</ script >
< Create let:actions on:success on:failure >
< input type = "text" bind:value ={ email } />
< input type = "password" bind:value ={ password } />
< input type = "text" bind:value ={ name } />
< button on:click ={ actions . create ( email , password , name )}>Register</ button >
</ Create > Пусть: Действия object
Объект с функцией.
| Имя | Описание |
|---|---|
create(email, password, name) | Регистрирует нового пользователя. @type - {string} |
В: Успех
Триггеры в успешном регистрации.
| Имя | Описание |
|---|---|
response | Ответ |
В: отказ
Триггеры в неудавшемся реестре.
| Имя | Описание |
|---|---|
response | Ответ |
Войдите по электронной почте и пароля.
< script >
import { AuthEmail } from ' metawrite ' ;
let email = ' ' ;
let password = ' ' ;
const success = ( e ) => {
// success callback
// `e` contains the user object
};
const failure = ( e ) => {
// failure callback
};
</ script >
< AuthEmail let:authorize on:success on:failure >
< input type = "text" bind:value ={ email } />
< input type = "text" bind:value ={ password } />
< button on:click ={ authorize ( email , password )}>Login</ button >
</ AuthEmail > Пусть: авторизовать function
Инициирует логин.
| Имя | Описание |
|---|---|
email | Электронная почта. @type - {string} |
password | Пароль. @type - {string} |
В: Успех
Триггеры на успешный вход.
| Имя | Описание |
|---|---|
email | Электронная почта. @type - {string} |
В: отказ
Триггеры при неудавшемся входе в систему.
| Имя | Описание |
|---|---|
error | Объект ошибки. |
Войдите через поставщика OAuth2.
< script >
import { AuthOAuth2 } from ' metawrite ' ;
</ script >
< AuthOAuth2
authProvider = " google "
success = " http://localhost:3000?success "
failure = " http://localhost:3000?failure "
let:authorize
>
< button on:click ={ authorize }>Login Google</ button >
</ AuthOAuth2 >| Имя | Описание |
|---|---|
authProvider | OAuth2 Provider. @type - {string} |
success | Урл успеха. @type - {string} |
failure | Неудача URL. @type - {string} |
Пусть: авторизовать function
Запрашивает текущего пользователя проверить, зарегистрировано ли в системе.
< script >
import { User } from ' metawrite ' ;
</ script >
< User let:user >
< h1 >Hello { user . name }!</ h1 >
< div >{ user . email }</ div >
< div slot = " error " >You are not logged in!</ div >
</ User > Пусть: object пользователя
Получите в настоящее время в системе пользовательских данных.
Получите список всех документов из коллекции.
< script >
import { Collection } from ' metawrite ' ;
</ script >
< Collection collectionId = " 5f56a3035a01f " let:documents >
You have { documents . length } documents.
</ Collection >| Имя | Описание |
|---|---|
collectionId | Коллекция уникальный идентификатор. @type - {string} |
| дополнительный | То же, что и здесь |
Пусть: документы array
Массив документов.
Пусть: Действия object
Объект с функцией.
| Имя | Описание |
|---|---|
reload() | Повторная коллекция. |
create(data, read, write) | Создайте новый документ в коллекции. read / write является необязательным, а текущий пользователь по умолчанию @type - {string[]} . data @type - {string} |
Получите документ. Если вы передаете свойство document с данными, нет никаких запрошенных данных.
< script >
import { Document } from ' metawrite ' ;
</ script >
< Document documentId = " 5f56a3asda01f " let:document >
Title: { document . title }
Text: { document . text }
</ Document >| Имя | Описание |
|---|---|
documentId | Документ уникальный идентификатор. @type - {string} |
collectionId | Коллекция уникальный идентификатор. @type - {string} |
| или | |
document | Документ, переданный из <Collection /> |
Пусть: object документа
Объект JSON с данными документа.
Пусть: Действия object
Объект с функцией.
| Имя | Описание |
|---|---|
update(data) | Обновите документ. data @type - {string} |
remove() | Удаляет документ. |
reload() | Повторный документ. |
В: Изменение
Триггеры при обновлении или удалении входа в систему.
Компоненты учетной записи позволяют вам управлять учетной записью пользователя.
<User /> Пусть: действия
| Имя | Описание |
|---|---|
reload() | Перезагрузить |
logout() | Выйти из текущего сеанса. |
logoutAll() | Выход из всех сеансов. |
logoutFrom(session) | Выход из конкретного сеанса. session @type - {string} |
object пользователяlogout ».logout .logoutFrom .logoutFrom отказа.logoutAll .logoutAll . < script >
import { User } from ' metawrite ' ;
</ script >
< User let:actions let:user >
< button on:click ={ actions . reload ()}>Reload user data</ button >
< button on:click ={ actions . get ()}>Get logged in user data</ button >
< button on:click ={ actions . logout ()}>Log out from current session</ button >
< button on:click ={ actions . logoutFrom ( ' sessionId ' )}>Log out from specific session</ button >
< button on:click ={ actions . logoutAll ()}>Log out from all sessions</ button >
<!-- If logged in -->
< p >Hi, { user . name }</ p >
</ User ><Create /> Пусть: действия
| Имя | Описание |
|---|---|
create(email, password, name) | Создает пользователя. Требуются email и password - @type - {string} . name необязательно - @type - {string} |
create успеха.create . < script >
import { Create } from ' metawrite ' ;
let name,
email,
password = ' ' ;
const success = ( e ) => {
// success callback
// `e` contains the user object
};
const failure = ( e ) => {
// failure callback
};
</ script >
< Create let:actions on:success on:failure >
< input type = "text" name = "name" placeholder = "name" bind:value ={ name } />
< input type = "text" name = "email" placeholder = "email" bind:value ={ email } />
< input type = "password" name = "password" placeholder = "password" bind:value ={ password } />
< button on:click ={ actions . create ( name , email , password )}>Create Account</ button >
</ Create ><Preferences /> Пусть: действия
| Имя | Описание |
|---|---|
reload() | Перезагрузить предпочтения. |
update(prefs) | Обновить предпочтения. prefs - @type - {object} |
reload успех.reload .update .update . < script >
import { Preferences } from ' metawrite ' ;
let prefs = {
// You can pass only the specific settings you wish to update.
};
</ script >
< Preferences let:actions >
< button
on:click ={() => {
actions . update ( prefs );
actions . reload ();
}}>Update Preferences</ button
>
</ Preferences ><RecoverPassword /> Пусть: действия
| Имя | Описание |
|---|---|
recover(email, url) | Восстановить пароль. email и url требуются и @type - {string} . url - это ваша страница, на которой вы будете обрабатывать secret с complete функцией. |
complete(user, secret, password, passwordAgain) | Полное восстановление пароля. user и secret автоматически устанавливаются metawrite , поэтому вам не нужно их устанавливать. Требуются password и passwordAgain - @type - {string} . |
reload успех.reload сбой.update .update . < script >
import { RecoverPassword } from " metawrite " ;
const url = " http://localhost:3000/reset-password " ; // URL that will point to the next step.
let email = ' ' ;
const successRecover = e => {
// success callback
// `e` contains the user object
};
const failureRecover = e => {
// failure callback
}
</ script >
<!-- localhost/forgot-password -->
< RecoverPassword let:actions on:successRecover on:failureRecover >
< input name = "email" type = "text" bind:value ={ email , url } placeholder = " Email " />
< button on:click { actions . recover ( email )}>Recover Password</ button >
</ RecoverPassword >
<!-- Then on localhost/reset-password -->
< script >
import { RecoverPassword } from " metawrite " ;
let password, passwordAgain = ' ' ;
const successComplete = e => {
// success callback
// `e` contains the user object
};
const failureComplete = e => {
// failure callback
}
</ script >
< RecoverPassword let:actions on:successComplete on:failureComplete >
< input type = "password" name = "password" bind:value { password } placeholder = " Password " />
< input type = "password" name = "password" bind:value { passwordAgain } placeholder = " Confirm Password " />
< button on:click { actions . complete ( password , passwordAgain )}>Set New Password</ button >
</ RecoverPassword ><Update /> Пусть: действия
| Имя | Описание |
|---|---|
name(name) | Обновите имя. Все поля требуются. @type - {string} |
email(email, password) | Обновить электронную почту. Все поля требуются. @type - {string} |
password(password, oldPassword) | Обновить пароль. Все поля требуются. @type - {string} |
name .name .email успешно.email .password .password . < script >
import { Update } from ' metawrite ' ;
let name,
email,
password,
newPassword,
oldPassword = ' ' ;
</ script >
< Update let:actions >
< button on:click ={ actions . name ( name )}>This updates name</ button >
< button on:click ={ actions . email ( email , password )}>This updates email</ button >
< button on:click ={ actions . password ( newPassword , oldPassword )}>This updates password</ button >
</ Update ><Verification />Создает и автоматически проверяет проверку электронной почты пользователя.
url -адрес типа строки для действий create должно быть там, где находится ваше приложение, или localhost .update действий вам не нужно что -либо передать, процесс автоматизирован. Пусть: действия
| Имя | Описание |
|---|---|
create(url) | Создать проверку. url - это то, что URL используется для создания ссылки на проверку, отправленной в ваш почтовый ящик. @type - {string} |
update(user, secret) | Полная проверка. user и secret устанавливаются автоматически metawrite . |
create Success.create сбоя.complete успех.complete сбое. < script >
import { Verification } from ' metawrite ' ;
const url = window . location . href ;
</ script >
< Verification let:actions >
< button on:click ={ actions . create ( url )} />
< button on:click ={ actions . update ()}>Update email verification status</ button >
</ Verification >Компоненты Auth позволяют вам аутентифицировать учетную запись пользователя.
<AuthEmail /> authorize успеха.authorize сбоя. < script >
import { AuthEmail } from ' metawrite ' ;
let email = ' ' ;
let password = ' ' ;
const success = ( e ) => {
// success callback
// `e` contains the user object
};
const failure = ( e ) => {
// failure callback
};
</ script >
< AuthEmail let:authorize on:success on:failure >
< input type = "text" bind:value ={ email } />
< input type = "text" bind:value ={ password } />
< button on:click ={ authorize ( email , password )}>Login</ button >
</ AuthEmail ><AuthOAuth2 /> | Имя | Описание |
|---|---|
authProvider | OAuth2 Provider. @type - {string} |
success | Урл успеха. @type - {string} |
failure | Неудача URL. @type - {string} |
| #### Директивы |
Пусть: Authorize ()
< script >
import { AuthOAuth2 } from ' metawrite ' ;
</ script >
< AuthOAuth2
authProvider = " google "
success = " http://localhost:3000?success "
failure = " http://localhost:3000?failure "
let:authorize
>
< button on:click ={ authorize }>Login Google</ button >
</ AuthOAuth2 ><CreateAnonymousSession /> Пусть: действия
| Имя | Описание |
|---|---|
create() | Создает анонимную сессию. |
< script >
import { CreateAnonymousSession } from ' metawrite ' ;
</ script >
< CreateAnonymousSession let:actions >
< button on:click ={ actions . create }>Create Anonymous Session</ button >
</ CreateAnonymousSession ><CreateJWT />Создает токен JWT.
Пусть: действия
| Имя | Описание |
|---|---|
create() | Создает токен JWT. |
< script >
import { CreateJWT } from ' metawrite ' ;
</ script >
< CreateJWT let:actions >
< button on:click ={ actions . create }>Create JWT token</ button >
</ CreateJWT ><MagicURL /> Пусть: действия
| Имя | Описание |
|---|---|
create(sessionId, email, url) | Создает магический сессию URL. Требуется электронная почта, URL должен указать на полную ступенчатую string , sessionId не требуется |
complete() | Проверяет и завершает сеанс Magic URL. |
< script >
import { MagicURL } from " metawrite " ;
let email = " "
const url = " http://localhost:3000/page-to-complete "
const successCreate = ( e ) => {
console . log (e)
}
const failureCreate = ( e ) => {
console . log (e)
}
const successComplete = ( e ) => {
console . log (e)
}
const failureComplete = ( e ) => {
console . log (e)
}
</ script >
< MagicURL let:actions on:successCreate on:successComplete on:failureCreate on:failureComplete >
< input type = "email" name = "email" placeholder = "Email" bind:value ={ email } />
< button on:click ={ actions . create ( email , url )}>Send login link</ button >
< button on:click ={ actions . complete ()}>Confirm Login</ button >
</ MagicURL >Компоненты аватара направлены на то, чтобы помочь вам выполнить повседневные задачи, связанные с изображением вашего приложения, значками и аватарами.
<Browser /> @type - {string}@type - {number}@type - {string}@type - {string} @type - {URL} < script >
import { Browser } from ' metawrite ' ;
</ script >
< Browser code = " firefox " let:src >
< img src ={ String ( src )} alt = " Browser " />
</ Browser ><CreditCard /> @type - {string}@type - {number}@type - {string}@type - {string} @type - {URL} < script >
import { CreditCard } from ' metawrite ' ;
</ script >
< CreditCard code = " amex " let:src >
< img src ={ String ( src )} alt = " card " />
</ CreditCard ><Favicon /> @type - {string} @type - {URL} < script >
import { Favicon } from ' metawrite ' ;
const url = window . location . href ;
</ script >
< Favicon { url } let:src >
< img src ={ String ( src )} alt = " favicon " />
</ Favicon ><Flag /> @type - {string}@type - {number}@type - {string}@type - {string} @type - {URL} < script >
import { Flag } from ' metawrite ' ;
</ script >
< Flag code = " canada " let:src >
< img src ={ String ( src )} alt = " flag " />
</ Flag ><Image /> @type - {string}@type - {number}@type - {number} @type - {URL} < script >
import { Image } from ' metawrite ' ;
let url = ' https://increas.io/ ' ;
let width,
height = 100 ;
</ script >
< Image { url } { width } { height } let:src >
< img src ={ String ( src )} alt = " someImage " />
</ Image ><QR /> @type - {string}@type - {optional}@type - {number}@type - {boolean} @type - {URL} < script >
import { QR } from ' metawrite ' ;
let text = ' https://increas.io/ ' ; // could be any text
let size = 500 ;
let margin = 1 ;
let download = false ;
</ script >
< QR { text } { size } { margin } { download } let:src >
< img src ={ String ( src )} alt = " QR Code " />
</ QR >Компоненты базы данных позволяют вам создавать структурированные коллекции документов, запросов и фильтров, а также управлять расширенным набором разрешений на доступ к чтению и записи.
<Collection /> CollectionId - требуется @type - {string}
Cache - Необязательно , по умолчанию установлен в false @type - {boolean}
Запрос: @type - {object}
Запросы - необязательно @type - {string[]}
Limit - необязательно @type - {number}
Offset - Необязательно @type - {number}
Cursor - необязательно @type - {string}
CurSordirection - необязательно @type - {string}
Порядок @type - {string[]}
OrderTyPes - необязательно @type - {string[]}
Пусть: действия
| Имя | Описание |
|---|---|
reload() | Перезагрузить |
create(documentId, data, read, write) | Создает документ. data - @type - {string} .read / write необязательно @type - {string[]} .documentId необязательно, по умолчанию генерирует уникальный @type - {string} . |
< script >
import { Collection } from " metawrite " ;
</ script >
< Collection collectionId = " 5f56a3035a01f " let:documents >
You have { documents . length } documents.
</ Collection ><Document /> @type - {string}@type - {string} Пусть: действия
| Имя | Описание |
|---|---|
reload() | Перезагрузить |
update(data) | Обновляет документ. data - @type - {object} |
remove() | Удаляет документ. |
< script >
import { Collection , Document } from ' metawrite ' ;
const collectionId = ' 5f56a3035a01f ' ;
</ script >
< Collection { collectionId } let:documents >
You have { documents . length } documents:
{ #each documents as document }
< Document { collectionId } documentId ={ document . $id } let:document let:actions >
Title: { document . title }
Text: { document . text }
< button on:click ={() => { actions . remove ()}}>Delete</ button >
</ Document >
{ /each }
</ Collection >Для получения дополнительной информации об использовании в реальном времени в Appwrite см. Документацию в реальном времени.
Realtime позволяет вам прослушать любые события на стороне сервера в режиме реального времени, используя метод подписки.
Вместо того, чтобы запрашивать новые данные через HTTP, подписка будет получать новые данные каждый раз, когда они меняются, любой подключенный клиент получает это обновление в течение миллисекундов через подключение к WebSocket.
Это позволяет создавать интерактивный и отзывчивый пользовательский опыт, предоставляя информацию из всех услуг Appwrite в реальном времени.
string | string[] Пусть: полезная нагрузка - полезная нагрузка из подписки будет содержать следующие свойства.
Пусть: действия
| Имя | Описание |
|---|---|
subscribe() | Подписка на все обновления, связанные с одним или несколькими каналами. |
unsubscribe() | Если вы больше не хотите получать обновления от подписки, вы можете отписаться, чтобы ваши обратные вызовы больше не вызывались. |
< script >
import { Realtime } from ' metawrite ' ;
</ script >
< Realtime channels = " account " let:actions let:payload >
< h1 >{ payload . timestamp }</ h1 >
< button on:click ={ actions . subscribe ()}>Subscribe to Account channel</ button >
< button on:click ={ actions . unsubscribe ()}>Unsubscribe from Account channel</ button >
</ Realtime >Компоненты хранения позволяют вам управлять файлами проекта. Вы можете загружать, просматривать, загружать и запросить все файлы проекта.
<Storage /> Пусть: действия
| Имя | Описание |
|---|---|
create(bucketId, fileId, file, read, write) | Загружает файл.fileId требуется @type - {string} , "unique()" будет генерировать случайный уникальный идентификатор, но вы можете использовать пользовательский.file @type - {File} и требуется.read / write @type - {string[]} и необязательно |
< script lang = " ts " >
import { Storage } from " metawrite "
// Required
let bucketId = " default "
let file : File ;
let fileId = " unique() " ; // this will generate random unique id, but you can use custom
// Optional
let read : string [];
let write : string [];
</ script >
< Storage { file } let:actions >
< button on:click ={ actions . create ( bucketId , fileId , file , read , write )}>Upload File</ button >
</ Storage ><FileList /> @type - {string}@type - {string}@type - {number}@type - {number}@type - {string}@type - {string}@type - {string} => write "ASC" или "DESC" Пусть: действия
| Имя | Описание |
|---|---|
reload() | Перезагрузить |
< script >
import { FileList } from " metawrite "
// Optional
let bucketId = ' default ' ;
let search = ' ' ;
let limit = 10 ;
let offset = 0 ;
let orderType = ' ASC ' ;
</ script >
< FileList { bucketId } { search } { limit } { offset } { orderType } let:actions let:files >
{ #each files as file }
< p >File: { file . name }</ p >
{ /each }
< button on:click ={ actions . reload ()}>Reload</ button >
</ FileList ><File /> @type - {string}@type - {string} Пусть: действия
| Имя | Описание |
|---|---|
download() | Загрузка файла. |
view() | Получите файл для просмотра. |
preview(width, height, quality, background, output) | Получить файл для предварительного просмотра. |
update(read, write) | Обновляет файл. |
delete() | Удаляет файл. |
< script lang = " ts " >
import { File } from ' metawrite ' ;
// Required
let bucketId : string ;
let fileId : string ;
// OPTIONAL
/** @type {number} */ let width;
/** @type {number} */ let height;
/** @type {string} */ let gravity;
/** @type {number} */ let quality;
/** @type {number} */ let borderWidth;
/** @type {string} */ let borderColor;
/** @type {number} */ let borderRadius;
/** @type {number} */ let opacity;
/** @type {number} */ let rotation;
/** @type {string} */ let background;
/** @type {string} */ let output;
/** @type {string[]} */ let read;
/** @type {string[]} */ let write;
</ script >
< File { bucketId } { fileId } let:actions >
< button on:click ={ actions . download ()}>Download File</ button >
< button on:click ={ actions . view ()}>File View</ button >
< button on:click ={ actions . preview ()}>Preview File</ button >
< button on:click ={ actions . update ( read , write )}>Update File</ button >
< button on:click ={ actions . delete ()}>Delete File</ button >
</ File >Служба функций позволяет создавать пользовательское поведение, которое может быть вызвано любыми поддерживаемыми событиями Appwrite System или предопределенным графиком.
Функции Appwrite Cloud позволяют автоматически запускать код Backend в ответ на события, запускаемые Appwrite, или установив его для выполнения в предварительно определенном графике. Ваш код хранится безопасным способом в вашем экземпляре Appwrite и выполняется в изолированной среде.
Вы можете узнать больше, следуя учебному пособию Appwrite по облачным функциям.
<Function /> Пусть: действия
| Имя | Описание |
|---|---|
reload() | Перезагрузить |
create(functionId, data) | Создает исполнение. functionId требуется , data могут быть пустой строкой, потому что необязательно . @type {string} |
create(functionId, executionId) | Получить исполнение. Оба параметра требуются. @type {string} |
< script >
import { Function } from ' metawrite ' ;
let functionId = ' someExecution ' ; // required
let newFunctionId = ' ' ;
let data = ' String of custom data to send to function. ' ; // could be empty string because optional
</ script >
< Function { functionId } { data } let:actions let:executions >
{ #each executions as execution }
< p >
Execution ID: { execution . $id }, Function ID: { execution . functionId }, Date Created: { execution . dateCreated }
</ p >
{ /each }
< input type = "text" name = "functionId" placeholder = "Function ID" bind:value ={ newFunctionId } />
< button on:click ={ actions . create ( newFunctionId , data )}>Create Execution</ button >
</ Function >Компоненты локализации позволяют вам настроить приложение на основе местоположения ваших пользователей.
<Continents /> Пусть: действия
| Имя | Описание |
|---|---|
reload() | Перезагрузить |
< script >
import { Continents } from ' metawrite ' ;
</ script >
< Continents let:actions let:continents >
< button on:click ={ actions . reload ()}>Reload</ button >
< p >There are { continents . sum } continents:</ p >
{ #each continents . continents as continent }
< p >{ continent . name }, { continent . code }</ p >
{ /each }
</ Continents ><Countries /> Пусть: действия
| Имя | Описание |
|---|---|
reload() | Перезагрузить |
< script >
import { Countries } from ' metawrite ' ;
let eu = true ; // if you want to list only EU countries
</ script >
< Countries let:actions let:countries >
< button on:click ={ actions . reload ()}>Reload</ button >
< p >There are { countries . sum } countries in the world:</ p >
{ #each countries . countries as country }
< p >{ country . name }, { country . code }</ p >
{ /each }
</ Countries >
< Countries { eu } let:actions let:countries >
< button on:click ={ actions . reload ()}>Reload</ button >
< p >There are { countries . sum } countries in EU:</ p >
{ #each countries . countries as country }
< p >{ country . name }, { country . code }</ p >
{ /each }
</ Countries ><Currencies /> Пусть: действия
| Имя | Описание |
|---|---|
reload() | Перезагрузить |
< script >
import { Currencies } from ' metawrite ' ;
</ script >
< Currencies let:actions let:currencies >
< button on:click ={ actions . reload ()}>Reload</ button >
< p >There are { currencies . sum } currencies:</ p >
{ #each currencies . currencies as currency }
< p >{ currency . symbol } - { currency . name } ({ currency . code })</ p >
{ /each }
</ Currencies ><Languages /> Пусть: действия
| Имя | Описание |
|---|---|
reload() | Перезагрузить |
< script >
import { Languages } from ' metawrite ' ;
</ script >
< Languages let:actions let:languages >
< button on:click ={ actions . reload ()}>Reload</ button >
< p >There are { languages . sum } languages:</ p >
{ #each languages . languages as language }
< p >{ language . name }, { language . code }></ p >
{ /each }
</ Languages ><Locale /> Пусть: действия
| Имя | Описание |
|---|---|
reload() | Перезагрузить |
object кода < script >
import { Locale } from ' metawrite ' ;
</ script >
< Locale let:actions let:code >
< h1 >Active Session</ h1 >
< button on:click ={ actions . reload ()}>Reload</ button >
< p >Location: { code . country }, { code . continentCode }</ p >
< p >IP: { code . ip }</ p >
</ Locale ><PhoneCodes /> Пусть: действия
| Имя | Описание |
|---|---|
reload() | Перезагрузить |
< script >
import { PhoneCodes } from ' metawrite ' ;
</ script >
< PhoneCodes let:actions let:codes >
< button on:click ={ actions . reload ()}>Reload</ button >
< p >There are { codes . sum } phone codes:</ p >
{ #each codes . phones as phone }
< p >{ phone . code } - { phone . countyName }></ p >
{ /each }
</ PhoneCodes >