Skip to content

Commit

Permalink
update doc add classes [English | Persian]
Browse files Browse the repository at this point in the history
  • Loading branch information
A1Gard committed Mar 24, 2022
1 parent 43d90c6 commit f03d62d
Show file tree
Hide file tree
Showing 11 changed files with 312 additions and 2 deletions.
4 changes: 4 additions & 0 deletions assets/css/fix.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,8 @@ img{

img.emoji{
display: inline-block;
}

td,th{
border: 1px solid #77777788 !important;
}
7 changes: 7 additions & 0 deletions classes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Classes

Anubias classes help you use other facilities, You can see list of classes:

- [app](/classes/app.md)
- [toast](/classes/toast.md)
- [storage](/classes/storage.md)
46 changes: 46 additions & 0 deletions classes/app.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# app

The `app` class is a general class
to do get general actions or get application's information.

## mainColor

Retrun the main color of application:

```javascript
text1.color = app.mainColor();
```

## colorOrMainColor

If you want to use safe color,
If the color is null then use main color You can use it:

```javascript
text1.color = app.colorOrMainColor(text2.color);
```

## isDark

The `isDark` function let you to know app is dark or not:
```javascript
if (app.isDark()){
// code
}
```

## pageBack
Go back page or minimize app:

```javascript
app.pageBack();
```

## pageLoad
You can load new page with this function

```javascript
app.pageLoad( Page2() );
```

Page2 is name of your page need to load
38 changes: 38 additions & 0 deletions classes/storage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# storage

The `storage` class to store data in secure storage with encryption.

## read

Read value as string
- first parameter is `key` as `String`

```javascript
await storage.read('samplekey');
```

## write

Write value as string by a key
- first parameter is `key` as `String`
- second parameter is `value` as `String`

```javascript
await storage.write('samplekey', 'my value here like a token');
```

## delete

Delete a key
- first parameter is `key` as `String`

```javascript
await storage.delete('samplekey');
```

## truncate
Erase storage of your application

```javascript
await storage.truncate();
```
57 changes: 57 additions & 0 deletions classes/toast.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@

# toast

Toast class help you to show a toast message

## Show

This is main function of toast class,
You can change default params as an object (xScript):

```javascript
toast.show({
'text': 'toast sample',
'bgColor': Colors.black38,
'txtColor': Colors.white,
'fontSize': 16.0,
'pos': toast.POS_CENTER,
'length': Toast.LENGTH_SHORT,
});
```
All members of the object are optional, You can ignore them.
for example:

```javascript
toast.show({
'text': 'My new toast msg :)',
'bgColor': Colors.red,
});
```

## show object information

| Key | Type | Default |
| ------------ | ------------ | ------------ |
| text | string | 'toast sample' |
| bgColor | color | Colors.black38 |
| txtColor | color | Colors.white |
| fontSize | float | 16.0 |
| pos | const | POS_CENTER |
| length | const | LENGTH_SHORT |

### pos - Position constants

- POS_CENTER
- POS_CENTER_LEFT
- POS_CENTER_RIGHT
- POS_TOP
- POS_TOP_LEFT
- POS_TOP_RIGHT
- POS_BOTTOM
- POS_BOTTOM_LEFT
- POS_BOTTOM_RIGHT

### length = toast duration

- LENGTH_SHORT
- LENGTH_LONG
8 changes: 8 additions & 0 deletions fa/classes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# کلاس ها

کلاس های آنوبیاس به شما کمک می‌کند از سایر امکانات نیز استفاده نمایید
و برنامه خود را جذاب‌تر کنید

- [app](/fa/classes/app.md)
- [toast](/fa/classes/toast.md)
- [storage](/fa/classes/storage.md)
48 changes: 48 additions & 0 deletions fa/classes/app.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# app

کلاس `app` یک کلاس عمومی است که
به شما اجازه می‌دهد که کارهای عمومی در برنامه انجام دهید
و اطلاعات از برنامه بدست بیاورید

## mainColor

برای دریافت رنگ اصلی برنامه :

```javascript
text1.color = app.mainColor();
```

## colorOrMainColor

اگر به یک رنگ ایمن نیاز داشتید
می‌توانید رنگ ورودی را به این تابع بدهید و در صورت خالی بودن رنگ،
آنگاه رنگ اصلی برنامه برای شما باز می‌گردد:

```javascript
text1.color = app.colorOrMainColor(text2.color);
```

## isDark

تابع `isDark` امکانش تخصیص این که برنامه به صورت تیره است یا خیر را به شما میدهد:
```javascript
if (app.isDark()){
// code
}
```

## pageBack
برای بازگشت به صفحه قبلی و یا کوچک کردن برنامه:

```javascript
app.pageBack();
```

## pageLoad
برای نمایش یک صفحه دیگر این تابع کارایی دارید

```javascript
app.pageLoad( Page2() );
```

Page2 در اینجا نام صفحه جدید جهت بارگزاری است
38 changes: 38 additions & 0 deletions fa/classes/storage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# storage

کلاس `storage` برای ذخیره و بازیابی داده‌های شما در یک بستر امن و رمزنگاری شده است .

## read

خواندن مقدار با نوع رشته string
- پارامتر اول `key` نوع `String`

```javascript
await storage.read('samplekey');
```

## write

نوشتن یک مقدار
- پارامتر اول `key` نوع `String`
- پارامتر دوم `value` نوع `String`

```javascript
await storage.write('samplekey', 'my value here like a token');
```

## delete

حذف یک مقدار
- پارامتر اول `key` نوع `String`

```javascript
await storage.delete('samplekey');
```

## truncate
پاک کردن کل مقادیر ذخیره شده

```javascript
await storage.truncate();
```
56 changes: 56 additions & 0 deletions fa/classes/toast.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# toast

این کلاس امکان نمایش پیام از نوع toast را می‌دهد

## Show

این تابع اصلی جهت نمایش است
شما می‌توانید تک‌تک مقادیر دلخواه را جایگزین کنید (xScript):

```javascript
toast.show({
'text': 'toast sample',
'bgColor': Colors.black38,
'txtColor': Colors.white,
'fontSize': 16.0,
'pos': toast.POS_CENTER,
'length': Toast.LENGTH_SHORT,
});
```
همه اعضای object بالا دلخواه می‌باشد شما هر یک از آنها رو می‌توانید نادیده بگیرید
مثال:

```javascript
toast.show({
'text': 'My new toast msg :)',
'bgColor': Colors.red,
});
```

## اطلاعات object show

| کلید | نوع | مقدار |
| ------------ | ------------ | ------------ |
| text | string | 'toast sample' |
| bgColor | color | Colors.black38 |
| txtColor | color | Colors.white |
| fontSize | float | 16.0 |
| pos | ثابت | POS_CENTER |
| length | ثابت | LENGTH_SHORT |

### pos - ثوابت جهت جایگاه پیام

- POS_CENTER
- POS_CENTER_LEFT
- POS_CENTER_RIGHT
- POS_TOP
- POS_TOP_LEFT
- POS_TOP_RIGHT
- POS_BOTTOM
- POS_BOTTOM_LEFT
- POS_BOTTOM_RIGHT

### length - ثوابت جهت طول نمایش پیام

- LENGTH_SHORT
- LENGTH_LONG
6 changes: 5 additions & 1 deletion fa/sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,8 @@
- [row](/fa/components/row.md)
- [text](/fa/components/text.md)
- [toggle](/fa/components/toggle.md)
-[Events | رویدادها](/fa/events.md)
-[Events | رویدادها](/fa/events.md)
- [Classes](/fa/classes.md)
- [app](/fa/classes/app.md)
- [toast](/fa/classes/toast.md)
- [storage](/fa/classes/storage.md)
6 changes: 5 additions & 1 deletion sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,8 @@
- [row](/components/row.md)
- [text](/components/text.md)
- [toggle](/components/toggle.md)
-[Events](/events.md)
- [Events](/events.md)
- [Classes](/classes.md)
- [app](/classes/app.md)
- [toast](/classes/toast.md)
- [storage](/classes/storage.md)

0 comments on commit f03d62d

Please sign in to comment.