
احصل على ائتمانات مجانية بقيمة 100 دولار على Digitalocean:
انضم إلى خلافنا:
Metawrite هو AppWrite SDK مع مكونات جاهزة للذهاب إلى Svelte / SvelteKit
يتم الحفاظ على هذه الحزمة من قبل Legreasio.
ملاحظة: الإصدارات
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 لمزيد من التعليمات.
مثال PSUEDO
التعامل مع مستويات متعددة من البيانات العلائقية ASYNC (وحالات التحميل والورق الخاص بها) بالكامل من علامة Svelte.
<!-- 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 مزود. @type - {string} |
success | عنوان URL للنجاح. @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 />يقوم بإنشاء التحقق من البريد الإلكتروني للمستخدم والتحقق منه تلقائيًا.
create url من سلسلة type for Action هو المكان الذي يتم فيه استضافة تطبيقك أو localhost .update ، لا تحتاج إلى تمرير أي شيء ، فإن العملية آلية. دع: الإجراءات
| اسم | وصف |
|---|---|
create(url) | إنشاء التحقق. url هو ما يستخدمه عنوان URL لإنشاء رابط التحقق الذي تم إرساله إلى صندوق بريدك الإلكتروني. @type - {string} |
update(user, secret) | التحقق الكامل. يتم تعيين user secret تلقائيا بواسطة metawrite . |
create النجاح.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 >تتيح لك مكونات المصادقة مصادقة حساب المستخدم.
<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 مزود. @type - {string} |
success | عنوان URL للنجاح. @type - {string} |
failure | URL الفشل. @type - {string} |
| #### التوجيهات |
دع: تفويض ()
< 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() | يتحقق ويكمل جلسة 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}
ذاكرة التخزين المؤقت - اختياري ، بشكل افتراضي تعيين إلى falsetpe @type - {boolean}
الاستعلام: @type - {object}
الاستعلامات - اختياري @type - {string[]}
LIMIT - اختياري @type - {number}
إزاحة - اختياري @type - {number}
المؤشر - اختياري @type - {string}
cursordirection - اختياري @type - {string}
OrderAttributes - اختياري @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 ، راجع وثائق الوقت الفعلي.
يتيح لك الوقت الحقيقي الاستماع إلى أي أحداث على جانب الخادم في الوقت الفعلي باستخدام طريقة الاشتراك.
بدلاً من طلب بيانات جديدة عبر 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()" ستقوم بإنشاء معرف فريد عشوائي ، ولكن يمكنك استخدام Custom.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} => اكتب "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 المدعومة أو بجدول زمني محدد مسبقًا.
تتيح لك AppWrite Cloud Cloud تشغيل رمز الواجهة الخلفية تلقائيًا استجابةً للأحداث الناتجة عن AppWrite أو عن طريق إعداده ليتم تنفيذه في جدول محدد مسبقًا. يتم تخزين الكود الخاص بك بطريقة آمنة على مثيل AppWrite الخاص بك ويتم تنفيذه في بيئة معزولة.
يمكنك معرفة المزيد من خلال اتباع تعليمي Cloud Cloud الخاص بـ 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 >