Skip to content

Commit

Permalink
a little slower
Browse files Browse the repository at this point in the history
  • Loading branch information
tarrinneal committed Oct 25, 2024
1 parent 4fcba18 commit 462a314
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions packages/pigeon/example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -386,14 +386,14 @@ class SendEvents: StreamEventsStreamHandler {
var count = 0
if !timerActive {
timerActive = true
Timer.scheduledTimer(withTimeInterval: 0.01, repeats: true) { _ in
Timer.scheduledTimer(withTimeInterval: 1, repeats: true) { _ in
if count >= 10 {
sink.endOfStream()
} else {
if ((count % 2) != 0) {
sink.success(IntEvent(data: Int64(count)))
if (count % 2) == 0 {
sink.success(IntEvent(data: Int64(count)))
} else {
sink.success(StringEvent(data: String(count)))
sink.success(StringEvent(data: String(count)))
}
count += 1
}
Expand Down Expand Up @@ -429,11 +429,11 @@ object SendClass : StreamEventsStreamHandler() {
count++
}
}
handler.postDelayed(this, 10)
handler.postDelayed(this, 1000)
}
}
}
handler.postDelayed(r, 10)
handler.postDelayed(r, 1000)
}
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ object SendClass : StreamEventsStreamHandler() {
count++
}
}
handler.postDelayed(this, 10)
handler.postDelayed(this, 1000)
}
}
}
handler.postDelayed(r, 10)
handler.postDelayed(r, 1000)
}
}
// #enddocregion kotlin-class-event
Expand Down
8 changes: 4 additions & 4 deletions packages/pigeon/example/app/ios/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ class SendEvents: StreamEventsStreamHandler {
var count = 0
if !timerActive {
timerActive = true
Timer.scheduledTimer(withTimeInterval: 0.01, repeats: true) { _ in
Timer.scheduledTimer(withTimeInterval: 1, repeats: true) { _ in
if count >= 10 {
sink.endOfStream()
} else {
if (count % 2) != 0 {
if (count % 2) == 0 {
sink.success(IntEvent(data: Int64(count)))
} else {
sink.success(StringEvent(data: String(count)))
Expand All @@ -71,13 +71,13 @@ class SendEvents: StreamEventsStreamHandler {
}
// #enddocregion swift-class-event

@UIApplicationMain
@main
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(withRegistry: self)
GeneratedPluginRegistrant.register(with: self)

let controller = window?.rootViewController as! FlutterViewController
let api = PigeonApiImplementation()
Expand Down

0 comments on commit 462a314

Please sign in to comment.